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

ScalaMtags computes a wrong symbol for members in package objects #105

Merged
merged 3 commits into from
Dec 10, 2017

Conversation

gabro
Copy link
Member

@gabro gabro commented Dec 9, 2017

Given

package object K {
  val x = 42
}

the symbol for x should be _root.K.package.x. Right now it's _root_.K.x

@@ -177,6 +177,8 @@ object SymbolIndexTest extends MegaSuite {
assertSymbolFound(5, 5)("_root_.scala.collection.immutable.List.")
"<<CharRef>>.create(...)" - // JavaMtags
assertSymbolFound(8, 19)("_root_.scala.runtime.CharRef.")
"<<Either>>[...]" -
assertSymbolFound(10, 15)("_root_.scala.util.Either#")
Copy link
Member

Choose a reason for hiding this comment

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

The expected symbol should be

_root_.scala.`package`.Either#

which is a type alias. However, I think we index that symbol as _root_.scala.Either in scalamtags. We need to add package to the owner when entering package objects in https://github.com/scalameta/language-server/blob/1299a44633f5f36f757ad26a08a52f53bc712b6c/metaserver/src/main/scala/scala/meta/languageserver/mtags/ScalaMtags.scala#L26

Copy link
Member

Choose a reason for hiding this comment

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

@gabro gabro changed the title ScalaMtags computes a wrong symbol for Either ScalaMtags computes a wrong symbol for members in package objects Dec 9, 2017
@olafurpg
Copy link
Member

olafurpg commented Dec 9, 2017

I rebased this PR on top of #107 and fixed the bug
2017-12-09 20 07 05

@gabro
Copy link
Member Author

gabro commented Dec 10, 2017

Nice! Let's rebase this on master once #107 is in and then merge

@olafurpg
Copy link
Member

PSA it's necessary to clean the index cache to pickup this change as described here https://github.com/scalameta/language-server/blob/master/CONTRIBUTING.md#troubleshooting

Once we move to sql we can probably version the index so algorithmic changes to mtags bump up the version and invalidate older caches.

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.

None yet

2 participants