earthly / earthly-emacs

Major mode for editing Earthly Earthfile
Mozilla Public License 2.0
18 stars 8 forks source link

tree-sitter as a syntax highlighting backend #19

Open wingyplus opened 1 year ago

wingyplus commented 1 year ago

I start thinking for along time about having tree-sitter for earthlyfile, but i dont have time to tackle this.

The benefit of it is we can unify syntax highlighting across editors (vim, emacs, helix, etc.) and can play some nice feature around it such as code folding, etc.

alexcb commented 5 months ago

there's a new repo that implements this: https://github.com/glehmann/tree-sitter-earthfile

Konubinix commented 3 months ago

IIUC, emacs does not support parsing the .scm files, making the tree-sitter project not that useful by default.

Nonetheless, @glehmann also created https://github.com/glehmann/earthlyls, using the work on https://github.com/glehmann/tree-sitter-earthfile to provide the AST that the LSP uses.

I added the built-in support for earthlyls in lsp-mode, so you should only need to run (lsp) in earthly-mode. The installation command I put in here needs the rust toolchain though.

I've been using earhlyls for a few weeks and it works very well now. Also, @glehmann is eager to get improvement suggestions. I encourage you to try it out.

Konubinix commented 3 months ago

One thing to note is that with the support of tree sitter, we can have bash commands highlighted in bash.

this

image

instead of this

image