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

Error messages about "Code navigation will not work" are confusing #662

Open
jqno opened this issue Apr 9, 2024 · 0 comments
Open

Error messages about "Code navigation will not work" are confusing #662

jqno opened this issue Apr 9, 2024 · 0 comments

Comments

@jqno
Copy link
Contributor

jqno commented Apr 9, 2024

Describe the bug

I'm not 100% sure if this issue belongs here or with Metals proper. Please don't hesitate to close if I mis-posted.

I re-installed my machine the other day and ran into some issues getting my workspace up-and-running.

First, I ran into this message:
Screenshot from 2024-04-09 13-08-45
(A) Not sure I can fault nvim-metals for this one, as it's the dressing.nvim plugin that clips the error message at an unfortunate spot, but on the other hand, if I pick "More information", I don't get the full error message either.

With dressing disabled, I do get the full message:
Screenshot from 2024-04-09 13-16-32

But when I select More information, it's still not clear what I need to do:

## Metals Info
  - Metals Server version: 1.2.2
  - Metals Java: 21.0.2 from Private Build located at /usr/lib/jvm/java-21-openjdk-amd64

Below are listed the build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.

## Workspaces

### Workspace: /home/jqno/w/dhl/dhl-parcel-transformation-service
 - Build definition is coming from sbt.
 - Build server currently being used is Bloop v1.5.15.

## Build Targets

### root
  - target type: Scala 3.3.3
  - goto functionality: metalsDecode:file:///home/jqno/w/my-project/root.metals-buildtarget
  - compilation: ✅ 
  - diagnostics: ✅ 
  - interactive: ✅ 
  - semanticdb: ✅ 
  - debugging: ✅ 
  - java: ✅ 
  - recommendation: Goto definition for Java classes will not work, please install jdk sources in java home. Searched: /usr/lib/jvm/src.zip, /usr/lib/jvm/lib/src.zip, /usr/lib/jvm/java-21-openjdk-amd64/src.zip, /usr/lib/jvm/java-21-openjdk-amd64/lib/src.zip

(...snipped lots of modules with green checkboxes...)

### my-project-build
  - target type: sbt 1.9.9
  - goto functionality: metalsDecode:file:///home/jqno/w/my-project/my-project-build.metals-buildtarget
  - compilation: ✅ 
  - diagnostics: ⚠️ 
  - interactive: ✅ 
  - semanticdb: ✅ 
  - debugging: ❌
  - java: ✅ 
  - recommendation: Goto definition for Java classes will not work, please install jdk sources in java home. Searched: /usr/lib/jvm/src.zip, /usr/lib/jvm/lib/src.zip, /usr/lib/jvm/java-21-openjdk-amd64/src.zip, /usr/lib/jvm/java-21-openjdk-amd64/lib/src.zip

### my-project-service-build-build
  - target type: sbt 1.9.9
  - goto functionality: metalsDecode:file:///home/jqno/w/my-project/my-project-build-build.metals-buildtarget
  - compilation: ✅ 
  - diagnostics: ⚠️ 
  - interactive: ✅ 
  - semanticdb: ✅ 
  - debugging: ❌
  - java: ✅ 
  - recommendation: Goto definition for Java classes will not work, please install jdk sources in java home. Searched: /usr/lib/jvm/src.zip, /usr/lib/jvm/lib/src.zip, /usr/lib/jvm/java-21-openjdk-amd64/src.zip, /usr/lib/jvm/java-21-openjdk-amd64/lib/src.zip

I was thrown off the path for a bit by the diagnostics: ⚠️ and debugging: ❌ lines, because it turns out they weren't relevant for the problem I was trying to solve. The jdk sources from the recommendation were the culprit.

(B) /usr/lib/jvm/java-21-openjdk-amd64/src.zip exists, but it turns out that it's a symlink to a file that didn't exist until I installed the openjdk-21-source package. Took me a while to figure this out.

(C) I manage my JDKs through SDKman, so I also didn't expect I'd need to install native Ubuntu packages for Java.

Expected behavior

(A) Can we have a way to see the full message somewhere? It's pretty long and it sometimes gets clipped, which results in confusion. Also, sometimes I press Escape before I really read the message, and then when I regret my sloppiness, there's no way to get the message back (it's not in :messages, for example)

(B) The Metals Doctor says "recommendation: Goto definition for Java classes will not work, please install jdk sources in java home." I think that should be phrased a little stronger, because 1) it's not just for Java classes, but Scala classes as well, not just the ones in external dependencies but often even classes in my own project, and 2) Metals becomes almost unusable without this, so the word 'recommendation' is kind of weak.

(C) Is it possible to configure (nvim-)Metals to point to my SDKMan directories? The error message doesn't say anything about it, and I couldn't really find it in the documentation either (though I fully admit I might have missed it; in which case I apologise)

Operating system

Linux

Version of Metals

v1.2.2

Commit of nvim-metals

4f9bf0c

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

1 participant