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: Add symbol listing for Qml #79

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

itzurabhi
Copy link
Contributor

@itzurabhi itzurabhi commented Jul 1, 2024

symbol listing for Qml added.

@narnaud narnaud self-requested a review July 2, 2024 14:16
@itzurabhi itzurabhi force-pushed the Qml/tree-sitter-queries branch from 2454abe to 11c72d1 Compare July 5, 2024 09:23
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.

This is on the right track. I didn't test it (I wonder if you see the symbols in the GUI yet), but the architecture definitely makes sense.

Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

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

Overall looks like a reasonable way forward 👍

One additional thing to consider though is that the FunctionSymbol class also runs a few small queries to figure out the names and types of parameters (see the argumentsFromQueryMatch function).

However, that is of course also C++-specific and won't work with QML.
We should try to find a solution for injecting the right behavior there as well.

Also added some minor nitpicks.

@itzurabhi itzurabhi force-pushed the Qml/tree-sitter-queries branch from 11c72d1 to 1cad851 Compare July 10, 2024 13:12
@itzurabhi
Copy link
Contributor Author

This is on the right track. I didn't test it (I wonder if you see the symbols in the GUI yet), but the architecture definitely makes sense.

yes we can

@itzurabhi itzurabhi force-pushed the Qml/tree-sitter-queries branch from 1cad851 to 548670e Compare July 11, 2024 11:55
@itzurabhi itzurabhi requested a review from narnaud July 11, 2024 12:06
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

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

The separation of concerns looks clean 👍

What I'd like to see addressed before merging:

  1. Find a way to make FunctionSymbol::arguments compatible with Qml.
    • Currently it's not capturing the individual parameters as @parameter, so the FunctionSymbol will always report 0 arguments
    • The types of the arguments would be extracted incorrectly in the FunctionSymbol::argumentsFromQueryMatch function, which would have to also differentiate between languages.
  2. Add tests for all types of QML symbol extraction. Currently this is entirely untested.

I guess we could also do these in follow-up PRs, but I don't expect much conflict in this part of the codebase at the moment, so it would be preferable to have everything in before merging.

@LeonMatthesKDAB
Copy link
Collaborator

Hm, I also took another look at the ClassSymbol. I guess that also won't work correctly, as it will probably associate all members from all sub-objects into itself.
It currently doesn't check whether there's another classsymbol that encompasses sub-members 🤔

@itzurabhi itzurabhi force-pushed the Qml/tree-sitter-queries branch from 548670e to e38b6b2 Compare July 18, 2024 10:34
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

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

Going in the right direction, but the testing should be more thorough.

@itzurabhi itzurabhi force-pushed the Qml/tree-sitter-queries branch from 6beb17d to d49b3ac Compare July 24, 2024 14:46
@itzurabhi itzurabhi force-pushed the Qml/tree-sitter-queries branch from 6495217 to b2a332d Compare July 24, 2024 15:21
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

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

Looks good. We'll want to follow up on this with fixes for FunctionSymbol and ClassSymbol, but a very good start 🥳

@LeonMatthesKDAB LeonMatthesKDAB merged commit 7898cb9 into KDAB:main Jul 25, 2024
5 checks passed
@itzurabhi itzurabhi deleted the Qml/tree-sitter-queries branch August 12, 2024 06:45
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.

3 participants