-
Notifications
You must be signed in to change notification settings - Fork 545
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
bug: LSP completion dialog should only recommend public members of a module #5660
Comments
Hi, I would love to work on this. I however need pointers to where this should be fixed. |
Task is yours. Thanks The entry point for completion logic is here: cairo/crates/cairo-lang-language-server/src/ide/completion/mod.rs Lines 19 to 59 in c6d6029
This looks to be cairo/crates/cairo-lang-language-server/src/ide/completion/completions.rs Lines 115 to 188 in c6d6029
As you can see, this is basically just a banch of ifs for various AST items. I guess you simply have to put appropriate filters here: cairo/crates/cairo-lang-language-server/src/ide/completion/completions.rs Lines 137 to 148 in c6d6029
BTW It would be awesome if you'd also contribute completion E2E tests, as you're touching this. There are none yet, but they should be pretty similar to hover test for example: https://github.com/starkware-libs/cairo/blob/main/crates/cairo-lang-language-server/tests/e2e/hover.rs Would you like to make this part? I don't want to enforce this on you. 😃 |
@Utilitycoder hey, how's it going? Would you like some assistance from my side in this area? |
@mkaput I have been sick but slowly getting back to optimum health. I will take a look and let you know If I'd be able to proceed with it. |
Moving this issue back to the backlog due to lack of activity. It's open for grabbing again! |
I think it is done (at least partially) after #6060 and #6091, no? We may just want to review if the logic of using public items only is needed somewhere else @mkaput @gilbens-starkware |
I didn't verify what you said, but I doubt so: Gil's work is adding auto-imports for stuff that is For example, in the screenshot from the issue description, |
Okay, so it is basically about fixing dot completions then |
Indeed it is not fixed. |
Bug Report
Cairo version:
2.6.3
Current behavior:
When defining a module with some public members and trying to import said members, a completion dialog appears, but the language server includes non-public members in the dialog. Additionally, the lang. server includes non-members in the dialog (in this case
ShapeGeometry
).Example below:
Trying to import non-public members (and non-members) results in an error of course:
Importing a public member works as expected:
Expected behavior:
The completion dialog should only include actual module members and only those that can actually be imported.
Steps to reproduce:
lib.cairo
in VS Code (ensure Cairo 1.0 extension is installed)use circle::
statementCTRL + Space
)Related code:
Other information:
Related issue: #5664
The text was updated successfully, but these errors were encountered: