-
Notifications
You must be signed in to change notification settings - Fork 201
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
feat: add Solidity language support #665
base: master
Are you sure you want to change the base?
Conversation
Please run the query formatter from nvim-treesitter ( |
I did, and also made two more commits but some tests are still failing. |
Or are you possibly targeting a different parser? We use https://github.com/JoranHonig/tree-sitter-solidity/blob/master/grammar.js (which has no |
queries/solidity/textobjects.scm
Outdated
|
||
; Conditionals | ||
(if_statement | ||
consequence: (_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are you getting this node from? It's not in the grammar.
Please check your queries against the grammar. If you install the solidity parser with nvim-treesitter and open the query in a recent Neovim, the query linter should show you which nodes and patterns are invalid. Mark the PR as ready for review when the query file check passes. (You can ignore the Tests for now; they're flaky.) |
I'm sorry, but are you using ChatGPT for this? Your queries bear little relation to the actual grammar. |
I've tried to ask Claude but unfortunately it does not help much. My initial thought was to grab |
No, that will not work at all. You need to look at the Solidity grammar specification I linked and work directly from that; you can't copy (even partially) queries from other languages. Trial and error is fine but
Please only push your changes once you are confident that they are correct; then we can help finetune. |
Thank you for the guideline. Will try to dive deeper into scm patterns and implement the textobjects from scratch as you suggested. Will mark this PR as ready for review once I'm confident with my queries. |
This PR adds textobjects support for the Solidity programming language. It introduces a new
textobjects.scm
file specifically for Solidity, enabling textobject functionalities when working with Solidity.Changes introduced:
textobjects.scm
file for SolidityTextobjects implemented:
Testing:
I have tested these textobjects with various Solidity code snippets to ensure they work as expected. However, further testing by the community would be appreciated to catch any edge cases or improvements needed.
Notes: