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

fix: InverseSemanticdbSymbols for symbolic names #5481

Merged
merged 1 commit into from Aug 16, 2023

Conversation

jkciesluk
Copy link
Member

Symbols in compiler have encoded names (eg. $at$at instead of @@) so we need to encode semanticdb symbols before matching on name.

Fixes #5469 and #5065

@jkciesluk jkciesluk linked an issue Jul 24, 2023 that may be closed by this pull request
@jkciesluk jkciesluk marked this pull request as ready for review July 24, 2023 11:35
@kasiaMarek
Copy link
Contributor

What about package names? Do you not need to encode those too?

)
_ <- assertCompletionItemResolve(
"val x: !!@@",
expectedLabel = "!!",
Copy link
Contributor

Choose a reason for hiding this comment

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

Question (sorry if doesn't make sense, just caught my attention): for the ::: from Scala's List above we get label with much more info (generic type signature, return type, etc.), but here for the !! we only see the symbol name. Is it expected? 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a valid question. Basically, for type completions, this information is not a part of label, but is provided in detail (in vscode its in the same place as doc)

@jkciesluk
Copy link
Member Author

What about package names? Do you not need to encode those too?

Thanks for noticing! Yes, although it looks like docstrings aren’t attached to packages (not sure yet why), but it's not connected to this PR. I added encoding there, so it will be easier to fix in the future

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM! Just one question, does it already work with Scala 3?

@jkciesluk
Copy link
Member Author

LGTM! Just one question, does it already work with Scala 3?

Yes, in scala 3 symbol names are kept in decoded form

Symbols in compiler have encoded names (eg. `$at$at` instead of `@@`) so we need to encode semanticdb symbols before matching on name.
@jkciesluk jkciesluk merged commit 0421dd0 into scalameta:main Aug 16, 2023
22 of 24 checks passed
@jkciesluk jkciesluk deleted the i5469 branch August 16, 2023 10:07
@jkciesluk jkciesluk modified the milestone: Metals v1.0.1 Aug 24, 2023
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.

Documentation Popup is empty for symbol named methods Semantic highlighting fails on import that contains @@
4 participants