Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change MATLAB parser #7386

Closed
acristoffers opened this issue Jun 19, 2023 · 4 comments
Closed

Change MATLAB parser #7386

acristoffers opened this issue Jun 19, 2023 · 4 comments
Labels
A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements

Comments

@acristoffers
Copy link
Contributor

Hi,

I developed a new MATLAB parser (acristoffers/tree-sitter-matlab) which is now being used in neovim too (nvim-treesitter/nvim-treesitter#4944).

However, I'm not an Helix user and don't know exactly what are your requirements, nor how to actually test things out. I have cloned this repo, changed the matlab entry to fetch the right repo and replaced the highlights.scm file for that of emacs and it kinda works, except it's not very colorful (I don't know if it is because of the theme - dracula - or wrong captures) and I noticed this (I don't know what's going on that only 2 of the exactly same things got highlighted):

image

Also, I could not get textobjects to work.

So, can someone point me out in the good direction to provide helix-specific queries? Do you have documentation on what is supported, what queries are available, which order the queries match (I guess first in the document gets priority)? I would love to work with you to make the parser support your editor, even if I don't use it.

Thank you.

P.S.: If you change to my parser, this issue will be resolved: #7058.

@acristoffers acristoffers added the C-enhancement Category: Improvements label Jun 19, 2023
@the-mikedavis
Copy link
Member

The scopes we use are here: https://docs.helix-editor.com/master/themes.html#syntax-highlighting. For example when rewriting neovim queries we often need to change @integer to @constant.numeric.integer and @parameter to @variable.parameter. I believe we have the same precedence as emacs' tree-sitter: the top-most pattern in the query file that matches gets precedence. Also see https://docs.helix-editor.com/master/guides/adding_languages.html#queries

@the-mikedavis the-mikedavis added the A-language-support Area: Support for programming/text languages label Jun 19, 2023
@acristoffers
Copy link
Contributor Author

Thank you very much, the first link is exactly what I had in mind (and is a very good documentation in that regard, btw). I would never have thought of looking into themes. What kind of queries do you support? I see in the documentation that you have highlights, textobjects, injection and indent, but I see some grammars with folds, tags and locals too. Can I include all of them?

@the-mikedavis
Copy link
Member

Yeah we only support highlights (plus injections and locals), indent and textobject queries currently. I think it's fine to include the others since they might be nice starting points when we implement folding for example. The tags.scm queries though I'm not sure we'll ever use, those could probably be dropped from the repo.

@gabydd
Copy link
Member

gabydd commented Jun 23, 2023

Closed by #7388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants