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 go to defintion for Sbt's Scala sources #1984

Merged
merged 1 commit into from
Aug 11, 2020

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Aug 10, 2020

Fixes #1981

@tgodzik tgodzik requested a review from ckipp01 August 10, 2020 11:48
pos => {
new LspPosition(pos.getLine() - 1, pos.getCharacter() - ident.size)
},
filterOutLocations = { loc => loc.getUri().isWorksheet }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we shouldn't adjust positions outside of the worksheets.

Copy link
Member

Choose a reason for hiding this comment

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

🤔 not work for now, but I'm wondering for clarity in the future if we should try to unify where we have adjustments done. For example we check here for worksheets and sbt and adjust accordingly. However, Ammonite also has some adjustments that we do, but those live in Ammonite.scala. I can see how that could be confusing from someone on the outside. Or, is it a good distinction to have that adjustments related to the PC are in AdjustLspData and other things live in their corresponding places? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I will move the adjustments to separate locations

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

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

Just a question and a nitpick.

@@ -77,6 +72,24 @@ trait AdjustLspData {
}
}

case class AdjustLspPos(
Copy link
Member

Choose a reason for hiding this comment

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

I normally don't love case classes that are verbs. What do you think of AdjustedLspPos?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

pos => {
new LspPosition(pos.getLine() - 1, pos.getCharacter() - ident.size)
},
filterOutLocations = { loc => loc.getUri().isWorksheet }
Copy link
Member

Choose a reason for hiding this comment

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

🤔 not work for now, but I'm wondering for clarity in the future if we should try to unify where we have adjustments done. For example we check here for worksheets and sbt and adjust accordingly. However, Ammonite also has some adjustments that we do, but those live in Ammonite.scala. I can see how that could be confusing from someone on the outside. Or, is it a good distinction to have that adjustments related to the PC are in AdjustLspData and other things live in their corresponding places? What do you think?

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

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

Looks good. LGTM!

@tgodzik tgodzik merged commit 0100f6a into scalameta:main Aug 11, 2020
@tgodzik tgodzik deleted the fix-goto-sbt branch August 11, 2020 09:25
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.

Goto Definition not working as expected in sbt files.
2 participants