nvim-metals icon indicating copy to clipboard operation
nvim-metals copied to clipboard

No "More information" for "Code navigation will not work"

Open arbitrary-dev opened this issue 3 years ago • 10 comments

Describe the bug

After importing my project I'm presented with:

Code navigation will not work for 182 build targets in this workspace due to mis-configuration.  Select 'More information' to learn how to fix this problem..

Request Actions:
1. More information
2. Don't show again

And if I choose 1 – nothing happens.

Expected behavior

More information is provided.

Operating system

Linux

Version of Metals

0.11.6

Commit of nvim-metals

How to find out it in packer.nvim?

arbitrary-dev avatar Jul 12 '22 10:07 arbitrary-dev

How to find out it in packer.nvim?

Run : PackerStatus, select nvim-metals, hit Enter. path shows you were the git repo is located on your machine.

kluen avatar Jul 12 '22 17:07 kluen

Thanks for the report @arbitrary-dev. I just played around a bit locally to try and mimic this and it seems to be working for me. Can you ensure you're on the latest Metals (0.11.7), and also the latest nvim-metals and give it a try again? When it fails can you do a :MetalsToggleLogs and see if anything funky is in the logs?

When you select 1 here it should bring up the Metals Doctor in a floating window.

ckipp01 avatar Jul 12 '22 18:07 ckipp01

So the only way is to follow the path and then do git show, right? @kluen

Then I'm using the latest fa5245876d32182c9bd893a00857ffa58decb3c6 commit of nvim-metals.

arbitrary-dev avatar Jul 12 '22 20:07 arbitrary-dev

Ok, now after the :MetalsUpdate to 0.11.7 the Metals Doctor window is actually shown to me after selecting 1. @ckipp01

Yet in this window I'm unable to see why "Code navigation will not work for 182 build targets...":

E486: Pattern not found: navig

I see only:

- recommendation: Goto definition for Java classes will not work, please install jdk sources in java home

Also :MetalsToggleLogs shows only cropped version of .metals/metals.log, which is kinda unexpected... I see no issues related to "Code navigation" in .metals/metals.log as well though.

arbitrary-dev avatar Jul 12 '22 20:07 arbitrary-dev

Yet in this window I'm unable to see why "Code navigation will not work for 182 build targets...":

It will be huge with 182 build targets, but basically you'd need to look through and see the ❌ marks in the various places, and then there is a key at the bottom which will explain them. The recommendation you posted actually is exactly the issue. Metals can't find the jdk sources it needs for navigation into Java sources, so navigation won't fully work. By chance are you running Arch? I see this often there. The solution is to install the *-src package that corresponds with the jdk you chose.

Also :MetalsToggleLogs shows only cropped version of .metals/metals.log, which is kinda unexpected... I see no issues related to "Code navigation" in .metals/metals.log as well though.

Well it scrolls, so you'd have to jump over to it and move down the logs.

ckipp01 avatar Jul 13 '22 05:07 ckipp01

To me "Code navigation will not work" is not the same as "Recommendation: Install Java sources if you want to navigate them".

When I see "Code navigation will not work" I have an impression that I won't be able to navigate the code in my own project.

arbitrary-dev avatar Jul 13 '22 07:07 arbitrary-dev

When I see "Code navigation will not work" I have an impression that I won't be able to navigate the code in my own project.

But this is the case. You won't be able to jump to the definition of java.time.Instant for example. No navigation from scala -> java source will work.

That could be could in your project that you'd want to navigate to, so it's still best to warn the user of this.

ckipp01 avatar Jul 13 '22 07:07 ckipp01

Then I believe it would be better to mark these with ❌'s instead of Recommendation:

arbitrary-dev avatar Jul 13 '22 20:07 arbitrary-dev

Then I believe it would be better to mark these with ❌'s instead of Recommendation:

These should be marked with ❌ in this scenario, are they not? Could you post the output of your doctor in a minimal reproduction?

ckipp01 avatar Jul 14 '22 06:07 ckipp01

Just wanted to check back in, are you still hitting on this, and if so can you put the full output of your doctor?

ckipp01 avatar Aug 11 '22 15:08 ckipp01

Going to go ahead and close. Feel free to report back if you're still hitting on this.

ckipp01 avatar Aug 22 '22 06:08 ckipp01