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

file_scoped_namespace_declaration range output different to namespace_declaration range #338

Open
Issafalcon opened this issue Jun 1, 2024 · 1 comment

Comments

@Issafalcon
Copy link

Hi,

Since the large overhaul to the parser, I have noticed that when using Treesitter queries in Neovim, that the range output in block scoped namespaces, include the entire contents of the enclosed block (i.e. The entire namespace).

This used to be the case for file scoped namespaces too, but after the overhaul, the range of file_scoped_namespace_declaration only includes the line that the namespace declaration is on.

This has altered the behaviour of a plugin that I maintain (https://github.com/Issafalcon/neotest-dotnet). It hasn't broken it in any major way, but the tests all started to fail because the tree of nodes that are formulated based on whether a class is nested in the range of the namespace have changed. The file scoped namespaces are ignored, and not included in the tree, because the range doesn't include the range position of the nested class itself.

I'm not sure if this is a deliberate breaking change, or if it's a regression defect, but thought I'd raise it anyway.

@mehdihadeli
Copy link

mehdihadeli commented Oct 11, 2024

The same issue after using file scoped namespace, now tree-sitter can't find the namespace content block, and it just shows me the scoped namespace line.

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

2 participants