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
Let nimsuggest refer to generic instance symbols #23414
Conversation
Can't you just store both the non-instantiated and the instantiated version in the nimsuggest database and use the appropriate one for each nimsuggest feature? Also, when the exception hints are off, don't store the extra data, to avoid wasting memory for users who don't use this feature? |
Well as mentioned I don't know exactly how to go about fixing this, what I got working is displaying the correct symbol but that broke some highlighting according to tests it seems, probably because of the onUse I removed. Not blaming you for this issue, nimsuggest is a huge mess from what I've seen, but I do not think the new exception tracking in the extension is ready in this state. |
Just add some extra field to SuggestFileSymbolDatabase, e.g.
Thanks for reporting this issue and for working on a fix. I think we can improve your fix the way I suggested above and it'll avoid breaking existing features. |
Are the test failures even a bug? Having trouble understanding what the mismatched output refers to. |
Yes, they are failing nimsuggest tests. E.g.
When working on nimsuggest, it is helpful to run the tests locally. You can do this by running in the nim directory:
Note that this tests the binary |
Apologies, meant the ones that have missing entries in the version that is tested for. Is there any significance to them being there?
|
I did not create these tests, but they're probably significant. We should ensure existing tests don't fail, unless we can prove that these particular tests are actually broken, which is probably not the case here. There's a missing skProc entry in this case, after this change. |
Yeah I'm aware it was missing, just wish there was documentation on all of this somewhere. Hard to figure out what highlight even means in this context, so could have been gibberish for all I know. |
Way it is now works I think, still unsure about the field in SuggestFileSymbolDatabase you suggested but looking into that. Example: |
I did not create these tests, but they're probably significant. We should ensure existing tests don't fail, unless we can prove that these particular tests are actually broken, which is probably not the case here. There's a missing skProc entry in this case, after this change.
The goal of the hints is to expose the exception info, inferred by the compiler. The fact that the actual exception inference in the compiler can be improved in certain cases is a separate issue. However, automatic exception inference can never be ideal, there will always be needed to annotate certain procvar types with a |
Hi, I've started working on finishing this in my own branch: |
Thanks for picking it up, looking forward to seeing this fantastic feature working as intended |
Ref #23202 (comment)
Makes nimsuggest show generic instances for symbols instead of the plain non-instantiated version, fixes displayed (inferred) exceptions on hover and makes the exception inlay hints added by #23202 accurate for generics.
I could see this breaking ide tooling in regards to finding usages of a symbol (seems to work as before though) and it now displays the substituted parameters instead of generic T ones upon hover of a function call, so might need a better solution or a followup by someone with more knowledge.