tree-sitter-grammars / tree-sitter-hyprlang

hyprlang grammar for tree-sitter
MIT License
105 stars 2 forks source link

Add instructions for Helix Editor. #1

Open aspizu opened 11 months ago

aspizu commented 11 months ago

Add instructions for Helix Editor

lucyColeclough commented 11 months ago

[[grammar]] name= "hypr" source= { git= "https://github.com/luckasRanarison/tree-sitter-hypr", rev= "master"}

- then run
```nushell
hx -g fetch
hx -g build

[!NOTE]

  • This will currently match all file-s matching *.conf I do not know how to change this, I believe this may be an issue resolved by this merge request
  • After running hx -g fetch, one can find this project~s source code in { your helix runtime directory}/grammars/sources/hypr

[!WARNING]

  • A note on the helix documentation: Helix parses query-s in the reverse direction to neovim. If this becomes an issue then one must clone this repository and rearrange the query-s for self hosting or as a fork of this repo.
luckasRanarison commented 11 months ago

@lucyColeclough Thanks for the detailed explanations, I hadn't the time to try helix yet. The highlights queries don't overlap so I think it should also work in Helix.

pascalkuthe commented 11 months ago

neovim and helix queriers are not at all identical so you need to create queries for helix if you want to use it with this grammar. We use different capture names and different query precedence

alphastrata commented 8 months ago
  • One can add this to their languages.toml
[[language]]
name= "hypr"
scope= "source.conf"
file-types= [ "conf"]
roots= [ "hyprland.conf"]
comment-token= "#"
grammar= "hypr"

[[grammar]]
name= "hypr"
source= { git= "https://github.com/luckasRanarison/tree-sitter-hypr", rev= "master"}
* then run
hx -g fetch
hx -g build
* then create the directory "{ your helix runtime directory}/queries/hypr" and put: `{ highlights.scm, indents.scm}` within this directory

* for textobject-s to work, one must write a `textobjects.scm` file

Note

* This will currently match all file-s matching *.conf
  I do not know how to change this, I believe this may be an issue resolved by [this merge request](https://github.com/helix-editor/helix/pull/8006)

* After running `hx -g fetch`, one can find this project~s source code in { your helix runtime directory}/grammars/sources/hypr

Warning

* A note on [the helix documentation](https://docs.helix-editor.com/guides/adding_languages): Helix parses query-s in the reverse direction to neovim. If this becomes an issue then one must clone this repository and rearrange the query-s for self hosting or as a fork of this repo.

@lucyColeclough It looks as though that PR is still open to prevent this hypr config from taking the parsing of all *.conf files -- are you able to shed any light on when/if that PR is likely to be resolved?

luckasRanarison commented 5 months ago

Update: The queries in this repo now use Helix capture names so it can also be used in Helix, and as I said there are no overlapping queries so there should not be priority problems.

lucyColeclough commented 5 months ago

are you able to shed any light on when/if that PR is likely to be resolved?

It appears there was recent work on this, I do not work on it