alemuller / tree-sitter-make

MIT License
44 stars 17 forks source link

(NetBSD) make format #6

Open nikkicoon opened 2 years ago

nikkicoon commented 2 years ago

I'm a pkgsrc developer, where I deal with NetBSD's flavor of make and our own make implementation. How would one approach extending this existing tree-sitter to support that, without creating a new one? There are no file extensions which differ, only grammar.

Aside: how is setting tabs vs whitespaces handled for this tree-sitter when it's used with the editor "Helix"? Even with gmake the style I used in projects included tabs after values. Or to be more clear: Is the handling of indent-style in the scope of this tree-sitter or does it use what the editor is set to?

alemuller commented 2 years ago

Hi @nikicoon, sorry for taking so long to answear :p. I'm back now :)

First. See the version on master (I haven't changed the default to avoid breaking nvim-treesitter).

It should be possible to extend. Can you share some resources on the others flavors?

Aside: how is setting tabs vs whitespaces handled for this tree-sitter when it's used with the editor "Helix"?

The recipe prefix accepts the value on .RECIPEPREFIX.

# This is a single file
# Run:
# $ make foo bar baz

.RECIPEPREFIX=>
foo:
>echo $@

.RECIPEPREFIX=!
bar:
!echo $@
# Empty fallbacks to tab

.RECIPEPREFIX=
baz:
    echo $@

However, it only accepts a single ascii char (can't use unicode 💩) on .RECIPEPREFIX.

The version on master should treat whitespace as default on GNU Makefile. I haven't implemented the variable that changes the behavior, if this is important to you I may have a look on the options.

I don't know Helix. It works fine on neovim.