Hello all,
I would like to announce tree-sitter grammar for fusion. The main purpose building this, was syntax highlighting for (neo)vim, which is my favorite editor. This grammar is already integrated in nvim-treesitter and can be used in an actual neovim easily.
This is the first time i build a grammar or something similar, so please do not expect too much, but I tried my best to get the grammar right.
Treesitter creates a performant incremental parser and builds up a concrete syntax tree, that could be used to build some language specific tools.
Here is a screenshot, so you get an idea what this is about.
I know most of you are using phpstorm or at least vscode, and therefore have no need for syntax highlighting. But maybe you have some ideas, what to do with an incremental parser or get inspiration while reading this.
Things that came to my mind are:
integration into github, because they use treesitter under the hood for syntax and navigation (also see github linguist, github semantic)
this could be a starting point for a simple linter
this could be a starting point for building up an Language Server
Hey @Marc,
the integration via github linguist should be easy. This also could have been done with https://github.com/networkteam/vscode-neos-fusion.
The hurdle could be the adoption of fusion in the github universe. But we just have to try and create a pull request in my opinion.
github semantic is more about navigation and is more like a meta language server internal to github. This is more a nice to have and maybe not worth the effort.
Writing a Language Server is a way bigger task and also would be a lots of follow up maintenance work.
I do not see that I have the time to get this started, but I could give you some hints, why I thought the grammer could be a starting point.
There are at least two Language Servers out there that use the treesitter grammar as base that I know about.
What you have with treesitter is a concrete Syntax Tree on only one file. Writing a Language Server means Indexing all Project related files and build up an abstract syntax tree with deep knowledge of the whole project. These Infos could be requested by any client (e.g. VSCode) and are delivered throug JsonRPC.
Performance will be a challange here. And having Treesitter on your hands that handles the low level parsing sounds like a nice starting point, as I see it.
I just want to point out, that the treesitter can not be used in classic vim (the one installed on most *nix systems) at the moment, because of missing treesitter support. I am not aware of any plugins. So the statements in the documentation seem missleading. You should mention that it is a neovim only plugin. I think i messed this up when writing (neo)vim in the annoucement an meant neovim in special - sorry for that.
NeoVim, a community driven fork of vim, has native support for tressitter and Language Servers in versions >= 0.6.
So, if anybody here likes to use vim and want to have fusion highlights, you need to install neovim as a dropin replacement.