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

improvement: use pc for go to def when stale semanticdb #7028

Merged
merged 9 commits into from
Jan 17, 2025

Conversation

kasiaMarek
Copy link
Contributor

resolves: #7027

@kasiaMarek kasiaMarek marked this pull request as ready for review December 19, 2024 10:47
@kasiaMarek kasiaMarek requested a review from tgodzik December 19, 2024 10:47
): Future[DefinitionResult] =
for {
fromCompiler <-
if (path.isScalaFilename && !isAmmonnite(path))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we just keep the current order for Ammonite? With this change we would not use compiler for Ammonite, right?

I wonder if we could just adjust tests to take that into account?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can also fix it and map generated Ammonite files to source files like we do for Scala CLI, if we want to still have Ammonite support.

Reordering is only half of a fix since for local symbols using pc will lead to generated sources. But I can also do that, if don't know where we are with Ammonite support.

Copy link
Contributor

Choose a reason for hiding this comment

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

I raised the topic on discord again and will start pushing it. In the meantime I don't think we want to work on any fixes, which we will be removing in the future.

So if it's too much work let's just leave it as is then.

private var fallbackDefn: Option[DefinitionResult] = None
private var nonLocalGuesses: List[String] = List.empty

private var fundScaladocDef = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private var fundScaladocDef = false
private var foundScaladocDef = false

@@ -233,7 +233,7 @@ class DefinitionLspSuite
|package a
|object B/*L1*/ {
| def main/*L2*/() = {
| println/*Predef.scala*/(A/*;A.scala:2;A.scala:3*/("John"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the idea here was to show both object and case class. Any idea why this changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that in SemanticDB the symbol found here is a synthetic apply, so we get both class and object, where in pc it will simply find the symbol of either class or object. I can create a followup to see how it behaves to make sure there is some reasonable consistency.

error = Some(e)
}

def withNonLocalGuesses(guesses: List[String]): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def withNonLocalGuesses(guesses: List[String]): Unit = {
def setNonLocalGuesses(guesses: List[String]): Unit = {

This is more a setter than a builder method, no? Could we make them more consistent or rename as above?

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

@kasiaMarek kasiaMarek merged commit 38950a2 into scalameta:main Jan 17, 2025
22 of 23 checks passed
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.

Incorrect go to def when stale SemanticDB
2 participants