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

feat: Select Smaller/Larger/Next/Previous Syntax Nodes #105

Merged
merged 8 commits into from
Jul 15, 2024

Conversation

LeonMatthesKDAB
Copy link
Collaborator

This allows navigating the code semantically.

Fix #64

@LeonMatthesKDAB LeonMatthesKDAB force-pushed the 64-select-syntax-nodes branch from 863eec6 to 76108e8 Compare July 11, 2024 10:10
@LeonMatthesKDAB LeonMatthesKDAB changed the title feat: Select Smaller/Larger Syntax Nodes feat: Select Smaller/Larger/Next/Previous Syntax Nodes Jul 11, 2024
@LeonMatthesKDAB LeonMatthesKDAB marked this pull request as ready for review July 11, 2024 10:18
@LeonMatthesKDAB LeonMatthesKDAB requested a review from narnaud July 11, 2024 10:18
Copy link
Member

@narnaud narnaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, it's actually working nicely.
The previous/next sibling can be really useful for fast scripting.

Small comments, nothing serious.

By moving the project setup into a macro we can save quite a few lines
of code.
This allows to navigate the code semantically.
Most functions were the same with only different function name and document type.
We can replace those implementations with a macro.
This patch adds functions to select the next/previous syntax node.
Combined with the previously added functions to select the
larger/smaller syntax node, this allows for very useful semantic code
navigation.
This aggregates the counts, which improves the history a lot.
@LeonMatthesKDAB LeonMatthesKDAB force-pushed the 64-select-syntax-nodes branch from 76108e8 to 5c93216 Compare July 15, 2024 12:31
Use LOG_RETURN in the select*SyntaxNode methods.

Add a warning if selectSmallerSyntaxNode doesn't find anything to
select.
@LeonMatthesKDAB LeonMatthesKDAB merged commit cd81b3b into KDAB:main Jul 15, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

Add "select larger syntax node" and "select smaller syntax node"
2 participants