You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, run npm install to install the tree-sitter cli.
Next, the grammar can be build using npm run build, or used to parse a file with npm run parse $file
In addition to the grammar.js files each parser depends on a common external scanner found at ./common/scanner.h.
The external scanner is responsible for parsing newlines and comments and keeps track of indentation to open and close scopes.
each grammar starts with the file node at the beginning of the rules.
Adding to neovim
tree-sitter-fsharp is supported through the usual installation methods of nvim-treesitter.
Installing the lastest grammar from this repo involves the following three steps:
Update your Neovim config for nvim-treesitter to refer to tree-sitter-fsharp.
The package.json defines some helpful targets for developing the grammar:
npm run generate rebuilds all parser.
npx tree-sitter test runs all tests for both parsers.
npx tree-sitter parse $file run the fsharp parser on $file and outputs the parse tree.
npx tree-sitter parse -d $file run the fsharp parser on $file and prints debug information.
How to contribute
Clone the project and start playing around with it.
If you find a code example which fails to parse, please reduce it to a minimal example and added to the corpus (fsharp/test/corpus/*.txt) as a test case.
For an introduction to developing tree-sitter parsers the official documentation is a good reference point.
PRs fleshing out the grammar or fixing bugs are welcome!