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

Can't navigate more levels of source code #606

Closed
iokacha opened this issue Apr 2, 2019 · 14 comments
Closed

Can't navigate more levels of source code #606

iokacha opened this issue Apr 2, 2019 · 14 comments

Comments

@iokacha
Copy link

iokacha commented Apr 2, 2019

Describe the bug
The Scala goto function work correctly, but I can't navigate more than one level of code source.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'project source code'
  2. Click on 'F12'
  3. Scroll down to some random class (List for example) and press F12
  4. See warning : Navigation for external library sources is not supported in Scala 2.11.12.

In lsp.trace.json i find many errors messages :

  • Navigation for external library sources is not supported in Scala 2.11.12.
  • code navigation does not work for the file ..../metals/readonly/scala/concurrent/duration/Duration.scala because it doesn belong to a build target

Expected behavior
I should be able to navigate scala source code or any dependency without problems.

Screenshots

ezgif-4-7ed9831404a5

Installation:

  • Operating system: macOS/Windows/Linux
  • Editor: Visual Studio Code
  • Sbt : 1.2.8
  • scala : 2.11.12
  • Metals version: v0.4.4

Additional context

  • METALS JAVAHOME = /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
  • METALS SBT Script : /usr/local/bin/sbt
  • METALS SERVER properties : -Dmetals.statistics=all

Search terms
vscode, metals, sbt,

@olafurpg
Copy link
Member

olafurpg commented Apr 2, 2019

Thanks for reporting! This is expected behavior with the latest release as explained by the " Navigation for external library sources is not supported in Scala 2.11.12." error message. This has been fixed in the latest SNAPSHOT, which you can try out with instructions here https://scalameta.org/metals/docs/editors/vscode.html#using-latest-metals-snapshot

@olafurpg olafurpg closed this as completed Apr 2, 2019
@iokacha
Copy link
Author

iokacha commented Apr 2, 2019

Great ! Thank you, I can navigate correctly now

@romankarlstetter
Copy link

I have a very similar problem in my current remote development setup (client on windows, actual code on linux, via vscode ssh remote development):

My setup:

  • VSCode 1.52.1
  • sbt 1.4.7
  • scala 2.12.13
  • Metals version: 0.9.10

As described by the original post, I can navigate from my own scala source files into any library (scala/java). In those libraries, navigation does not work at all. I do not see any warnings, though.
I'd be happy to help debug this problem.

@tgodzik
Copy link
Contributor

tgodzik commented Feb 9, 2021

@romankarlstetter could you try the newest snapshot? There might be some things fixed there, I did a refactoring around dependency sources.

@romankarlstetter
Copy link

Thanks for the quick answer.

I just tried with snapshot version 0.9.10+108-895ca516-SNAPSHOT, but unfortunately it still does not work.

@tgodzik
Copy link
Contributor

tgodzik commented Feb 9, 2021

I can navigate without na issue, is there anything in the logs? Could report a new issue with some reproduction information and the steps that you are following?

@romankarlstetter
Copy link

I just tried to come up with a smaller example to reproduce the issue and then noticed that navigation in scala dependencies actually works fine. Only navigating java dependencies does not work (I tried with a new flink project, see here), even though opening them via F12 does work .

@tgodzik
Copy link
Contributor

tgodzik commented Feb 9, 2021

I just tried to come up with a smaller example to reproduce the issue and then noticed that navigation in scala dependencies actually works fine. Only navigating java dependencies does not work (I tried with a new flink project, see here), even though opening them via F12 does work .

Navigating java dependencies is not supported unfortunately. There might be some work done that unblocks it, but until then you can subscribe to scalameta/metals-feature-requests#5

@tgodzik tgodzik added this to the Metals v0.10.0 milestone Feb 19, 2021
@wpopielarski
Copy link

hi @tgodzik,
not sure if you still look at issue but I have similar one.
Metals in vscode deluges me with tones of something like this:

[0m2021.06.02 12:17:06 ERROR code navigation does not work for the file '/Users/wpopielarski/code/spark/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala' because the SemanticDB file '/Users/wpopielarski/code/spark/sql/core/target/bloop-bsp-clients-classes/classes-Metals-CPogaO_dRfmmjZYXT3nLNA==/META-INF/semanticdb/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala.semanticdb' doesn't exist. There can be many reasons for this error. �[0m

then trying to navigate in Spark project https://github.com/apache/spark.git
Thanks for advice

@tgodzik
Copy link
Contributor

tgodzik commented Jun 2, 2021

@wpopielarski it seems spark doesn't properly compile with Bloop:

[E] Unexpected error when compiling spark-core_2.12: 'null'
[T] java.lang.NullPointerException
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:114)
[T]     scala.reflect.internal.Trees.itransform(Trees.scala:1409)
[T]     scala.reflect.internal.Trees.itransform$(Trees.scala:1400)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.api.Trees$Transformer.transform(Trees.scala:2563)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1919)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:114)
[T]     scala.reflect.internal.Trees.itransform(Trees.scala:1411)
[T]     scala.reflect.internal.Trees.itransform$(Trees.scala:1400)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.api.Trees$Transformer.transform(Trees.scala:2563)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1919)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:114)
[T]     scala.reflect.internal.Trees.itransform(Trees.scala:1411)
[T]     scala.reflect.internal.Trees.itransform$(Trees.scala:1400)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.api.Trees$Transformer.transform(Trees.scala:2563)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1919)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:114)
[T]     scala.reflect.internal.Trees.$anonfun$itransform$1(Trees.scala:1421)
[T]     scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2608)
[T]     scala.reflect.internal.Trees.itransform(Trees.scala:1420)
[T]     scala.reflect.internal.Trees.itransform$(Trees.scala:1400)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:28)
[T]     scala.reflect.api.Trees$Transformer.transform(Trees.scala:2563)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1919)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStat(RefChecks.scala:1220)
[T]     scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.$anonfun$transformStats$1(RefChecks.scala:1204)

You might try with sbt build server.

@tgodzik
Copy link
Contributor

tgodzik commented Jun 2, 2021

Or you could try importing the project via sbt instead of maven, that seems to also work. Might be a bug in the Bloop maven plugin.

@wpopielarski
Copy link

wpopielarski commented Jun 4, 2021

I owe you if you could give me some advices how to use sbt to import maven projects. Any recipe how to do it welcome. Spark is big project with many modules so hacking every module seems to be very painful at first glance of eye.

About switching build server:

Unable to switch build server since there is only one supported build server 'Bloop' detected for this workspace

info given by metals

I found that Spark uses sbt 0.13.18 in project/build.properties. Let me try to bump it up to 1.4.1

OK, I checked it and situation is rather hopeless in term to use sbt build server. There is too many dependencies to plugins which work with sbt 0.13.x and there are no versions for sbt 1.x and look somehow stale and not maintained.

@tgodzik
Copy link
Contributor

tgodzik commented Jun 4, 2021

Ach, so build server here is a no go, but since it is actually an sbt project you should be able to import the build definition from sbt, which I checked works ok. You can run a commad Run Doctor and there should be a link to reset the used build tool. Afterwards you should be asked whether to use sbt or maven. If you choose sbt, you should be able to import the build correctly.

spark-1622794829660

@wpopielarski
Copy link

I know Doctor and used id and only for oldDeps module are some warnings. Strange thing for me is that I see some symbol like class (of module A) unrecognised in file in module B but inside module A this symbol is recognised and navigation possible. Anyway I get it is subtle problem so don't want to nag you too much

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

No branches or pull requests

5 participants