Treesitter grammar for fusion

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 @jirgn,

that’s really cool :slight_smile: :slight_smile: Thank you so much!

All the best,

1 Like

github integration sounds fun :wink:

and also a language server for example for vscode:

i have no idea how to get started but i would like to help with these ideas - just ping me :wink:

Hey @Marc,
the integration via github linguist should be easy. This also could have been done with
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.

More Details about Implementation could be found on Language Server Extension Guide | Visual Studio Code Extension API.
I think looking into the bash language server mentioned above would be a good starting point too.


Hey @jirgn ,

thanks again for your package :slight_smile: I’ve just written the page Developer Tooling - Features - Neos CMS - Neos Docs where I highlight the package as well :slight_smile:

All the best,

Hey @sebastian,

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.

And thanks for the documentation page. I did not know about Thanks to Language Servers, it should be easy to use this in neovim as well → see neovim lspconfig

If anybody struggles to get this running give me a ping

greez and happy new year

Hey @jirgn ,

I updated the texts, hope it’s better now :slight_smile:

All the best,

1 Like