Skip to content

Implement definition provider, atm without range support for Scala 2 and Java symbols#57

Open
rochala wants to merge 9 commits into
raw-presentation-compiler-with-pc-diagsfrom
definitions
Open

Implement definition provider, atm without range support for Scala 2 and Java symbols#57
rochala wants to merge 9 commits into
raw-presentation-compiler-with-pc-diagsfrom
definitions

Conversation

@rochala

@rochala rochala commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

This PR will use new method: symbolSource that is yet to be released and implemented by metals.

DefinitionProvider in SLS is kept simple with following heuristic:

  1. Ask Presentation Compiler for SymbolSource,
    • Scala 3 - You've successfully received path to tasty + range yay, we're good to go,
    • Same source symbol - You've successfully received path to source + range, yay, we're done,
    • Scala 2 / Java from external jar - We've received path to classjar, in classjar classfile. That's good enough to find source but sadly no range information
    • Scala 2 / Java from our modules - ATM it is very similar to external jar, but we receive just classfile name. Then we can find source path by filtering workspace file for best match of the file (This can be improved by actually supporting Scala 2 targets with, e.g semanticdb, but this LSP is not about that)
  2. If we have range, just return it, in other scenarios return 0, 0. In the future this will be replaced with actual parsers to find the definition. I think treesitter + JDT or scalameta dunno atm
video.mp4

@rochala rochala force-pushed the raw-presentation-compiler-with-pc-diags branch from af64c1f to a11a723 Compare October 16, 2025 23:15
@rochala rochala force-pushed the raw-presentation-compiler-with-pc-diags branch from a11a723 to 6ec22a2 Compare March 1, 2026 11:12
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.

1 participant