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

Creation of class objects are not recognized #72

Open
ralph-bergmann opened this issue May 5, 2024 · 2 comments
Open

Creation of class objects are not recognized #72

ralph-bergmann opened this issue May 5, 2024 · 2 comments

Comments

@ralph-bergmann
Copy link

If a class is not generic, or it is generic but the generic type is not defined, the creation of an object of that class is not recognized.

SCR-20240505-dfzg

I use flash.nvim to select code blocks (nodes from tree-sitter?).

On line 47, you can see that it has recognized MaterialPageRoute with its constructor arguments (pink label b). However, it doesn't recognize ListenableBuilder (line 30) or MaterialApp (line 33) because they are not generic types (no pink label).

It also doesn't recognize MaterialPageRoute when I remove its generic type:
SCR-20240505-dkse

I hope I was able to describe the problem :-)

@TimWhiting
Copy link
Collaborator

TimWhiting commented May 5, 2024

I believe this is partially due to the fact that function calls and constructors calls occupy the same space in the grammar. There is no way to tell syntactically whether it is a function call or a constructor call. There are conventions of course (such as classes are typically capitalized), but there is no way to tell it from a grammar's point of view.

Tree sitter is a grammar, not a language server, and so it must handle things from a syntactic grammar's standpoint. Unfortunately that means that in order to handle all valid dart programs, we cannot assume capitalization means anything.

I guess I'm a bit confused about the question though, and the issues though. If it has to do with tree sitter queries though, Neovim has their own highlighting and query rules they maintain for Dart separate from this repository.

@ralph-bergmann
Copy link
Author

I don't know how it all works. I just realized that it doesn't work as expected or as I would wish :-)
The nvim-treesitter links to this project. So I assumed it was the right place for my problem.

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