metals icon indicating copy to clipboard operation
metals copied to clipboard

Go To Definition and Go To Implementation not working properly

Open vzmerr opened this issue 2 years ago • 20 comments

Describe the bug

In the following code in Scala 3 Completions file, we have the following problem on the toString method of Symbol.Symbol

https://user-images.githubusercontent.com/109077949/181247893-630530b5-cd5a-422b-9e01-901cf76ddb93.mov

:

Expected behavior

No response

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

0.11.7+61-a6299f3a-SNAPSHOT

Extra context or search terms

No response

vzmerr avatar Jul 27 '22 12:07 vzmerr

Looks like it's the same issue as was fixed in https://github.com/lampepfl/dotty/pull/15536

We can confirm when we update metals to 3.2.0

tgodzik avatar Jul 27 '22 13:07 tgodzik

One extra case to check Go To def

vzmerr avatar Aug 03 '22 12:08 vzmerr

One extra case to check

That is unrelated, but it does work for me. It needs the code to compile though.

tgodzik avatar Aug 03 '22 13:08 tgodzik

One extra case to check

That is unrelated, but it does work for me. It needs the code to compile though.

I ran the tests, so it is compiled. I wonder why it is not working on my side.

By the way, I guess it would be cool if we add a trouble shoot tutorial in the docs.

vzmerr avatar Aug 03 '22 14:08 vzmerr

I ran the tests, so it is compiled. I wonder why it is not working on my side.

Where did you run the tests though? IF from test explorer then it can't work without semanticdb, which seems to be the case here

tgodzik avatar Aug 03 '22 14:08 tgodzik

Where did you run the tests though?

sbt

vzmerr avatar Aug 03 '22 14:08 vzmerr

Where did you run the tests though?

sbt

Yeah, sbt compilation is unrelated unless you use sbt server. If you use Bloop it probably didn't compile. Maybe something is shown in the problems view?

tgodzik avatar Aug 03 '22 14:08 tgodzik

Problem View Ammonite Yes, 66 problems

vzmerr avatar Aug 03 '22 14:08 vzmerr

the problem might be Bloop Screenshot 2022-08-03 at 16 42 15

vzmerr avatar Aug 03 '22 14:08 vzmerr

Try Clean compiler workspace command

tgodzik avatar Aug 03 '22 14:08 tgodzik

Try Clean compiler workspace command

after running sbt clean followed by sbt compile, the problems number increased to 227.

Same with Clean Java Language Server Workspace command.

vzmerr avatar Aug 03 '22 15:08 vzmerr

@vzmerr this clean command is located in Metals ta Screenshot from 2022-08-03 18-29-31

dos65 avatar Aug 03 '22 15:08 dos65

@vzmerr if you are using sbt extensively you may consider switching build server to sbt

kpodsiad avatar Aug 03 '22 15:08 kpodsiad

@dos65 thanks the problems got reduced to 3 Screenshot 2022-08-03 at 17 44 44

@kpodsiad

if you are using sbt extensively you may consider switching build server to sbt

how do I do that?

vzmerr avatar Aug 03 '22 15:08 vzmerr

The standard way of using Metals is with Bloop, though. So I guess for the sake of revealing the functionality of Metals from the user perspective, I have to stick to Bloop.

vzmerr avatar Aug 03 '22 15:08 vzmerr

@vzmerr you need to trigger compilation once from sbt - BuildInfo is a generated source and only sbt can generate it

dos65 avatar Aug 03 '22 15:08 dos65

@vzmerr you need to trigger compilation once from sbt - BuildInfo is a generated source and only sbt can generate it

But I did so. I ran the test.

vzmerr avatar Aug 03 '22 15:08 vzmerr

I think I really have to make a troubleshoot doc PR

vzmerr avatar Aug 03 '22 15:08 vzmerr

The issue got solved by deleting the .bloop directory and then compiling and importing build. credit to @dos65 Also, with the newest work of Vadim on Bloop, this issue might not be encountered by users again :)

vzmerr avatar Aug 03 '22 16:08 vzmerr

The issue got solved by deleting the .bloop directory and then compiling and importing build. credit to @dos65 Also, with the newest work of Vadim on Bloop, this issue might not be encountered by users again :)

I mean the Problems view issue, not the javadoc on hover one.

vzmerr avatar Aug 05 '22 09:08 vzmerr

Now Scala 3.2.0 is released https://github.com/lampepfl/dotty/pull/15536 closing, if there're remained issues related to this, feel free to open a new one :)

tanishiking avatar Sep 29 '22 06:09 tanishiking