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

Julia TS node names have changed #38

Closed
ArbitRandomUser opened this issue Aug 7, 2023 · 8 comments
Closed

Julia TS node names have changed #38

ArbitRandomUser opened this issue Aug 7, 2023 · 8 comments

Comments

@ArbitRandomUser
Copy link

ArbitRandomUser commented Aug 7, 2023

I'm not sure why , but right now julia textsubjects is broken.
it looks like the node names are different , changing to appropriate node names in the queries scm seems to make it work.

comment is now line_comment
array_expression is now vector_expression ,

i dont have much of an idea on Treesitter, but i can make a PR with the changes that i did to get it working , may i ?

@RRethy
Copy link
Owner

RRethy commented Aug 9, 2023

Yea, feel free to make a PR and I'll merge. I'm not familiar with Julia so I personally won't be putting up a fix.

cc @timoleistner who originally added Julia support.

timoleistner added a commit to timoleistner/nvim-treesitter-textsubjects that referenced this issue Nov 2, 2023
Update julias treesitter node names according to 
RRethy#38

Added additional node names too.
@timoleistner
Copy link
Contributor

Since it's been a while and @ArbitRandomUser did not create a pull request, I've done it.
Sadly, I can't test this as I get the following error when I try to use smart textsubjects:

E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at posit
ion 2 for language julia
stack traceback:
        [C]: in function '_ts_parse_query'
        /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: in function 'get_query'
        .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:108: in function 'get_query'
        .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:201: in function 'prepare_query'
        .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:397: in function 'iter_group_results'
        .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:320: in function 'get_capture_matches'
        .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:445: in function 'fn'
        /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree'
        .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:440: in function 'get_capture_matches_recursively'

        ...sitter-textsubjects/lua/nvim-treesitter/textsubjects.lua:111: in function 'select'
        [string ":lua"]:1: in main chunk

This does happen no matter where I do this in my code.

Please let me know if I should create a separate issue or if you need more information.

@RRethy
Copy link
Owner

RRethy commented Nov 2, 2023

E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at posit
ion 2 for language julia

That would indicate your Julia parser may be out of date.

@timoleistner
Copy link
Contributor

fixed it :)

RRethy pushed a commit that referenced this issue Nov 2, 2023
* Update treesitter node names

Update julias treesitter node names according to 
#38

Added additional node names too.

* fixes E5108 invalid node type at position 2 for language julia
@RRethy RRethy closed this as completed Nov 2, 2023
@ArbitRandomUser
Copy link
Author

was waiting for you to chime in @timoleistner, your fix is neat and more comprehensive than mine.
Thanks :)

@ArbitRandomUser
Copy link
Author

bumping because i dont want to make a new issue for this ,
@timoleistner , could you also add in so that let blocks are also selected ?

@timoleistner
Copy link
Contributor

timoleistner commented Jan 15, 2024

Created a pull request for let statements.
btw, you can also find textsubjects by your own by using TSPlayground.
I'd be happy if julia gets complete support by this plugin and I know there are some things probably still missing (like the container-inner file).
Edit: Just noticed the deprecation notice on TSPlayground. The functionality is now build into neovim.

Use :Inspect to show the highlight groups under the cursor
:InspectTree to show the parsed syntax tree

@ArbitRandomUser
Copy link
Author

@timoleistner it seems the TS node names have been slightly modified again ,
parameter_list is no longer to be used , but im not sure what it should be replaced with ( signature ?)

tree-sitter/tree-sitter-julia#133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants