"No Definition found for" symbol error without Metals log explanation
Describe the bug
in this screenshot, metals show "no definition found" error, when a definition is clearly available
also Metals log doesn't show any attempt to find the definition, this shouldn't happen
Expected behavior
should show attempt to find the definition
Operating system
Linux
Editor/Extension
VS Code
Version of Metals
1.4.2
Extra context or search terms
No response
Thanks for reporting! Do you see anything in .metals/reports that could point to an issue? We are doing some improvements around that might help in https://github.com/scalameta/metals/pull/7028
I've been getting that today:
error id: WorkService#fetchData().
file://<WORKSPACE>WorkService.scala
empty definition using pc, found symbol in pc: WorkService#fetchData().
semanticdb not found
|empty definition using fallback
non-local guesses:
-
Document text:
Yet the Scala file below contains:
private def fetchData(
I recently renamed that symbol but everything is compiling as far as I can tell.
If no semanticdb is present and pc is having issues maybe the code doesn't compile, but it's not obvious why. 🤔 Though since it's a local symbol it should be simple to find for the compiler. Any chance to get a reproduction?
It's possible that project the current module depends on is not compiling and because of that it's not being attempted?
You could try to turn on metals.verboseCompilation and check the logs if it's indeed compiling.
@matthughes did it actually fail to find the definition or are just seeing an error report? I think it's a bug with reporting.
I also got this after renaming a symbol in metals.log:
SEVERE: empty definition using pc, found symbol in pc:
<none>. (full report at: ...
I need to delete .metals and .bloop to clean the err maybe semanticdb needs refresh after rename?
@tgodzik thanks a lot! can't find the report file, presumably it was generated
ideally this should be automatically included in telemetry
@doofin, if otherwise metals seems to work, you don't have to do anything. Maybe I should change it to warning, so it looks less important.
Hi @kasiaMarek metals ide shows red underline for the symbol after renaming but sbt compile works, it's actually a bit annoying since I need to delete.metals and.bloop, etc and reimport project to make the errors go away, glad to contribute if I have more information
To reproduce: In any sbt project, rename a top-level object name, and the referenced site will be red underlined sometimes (half of the time)
@doofin, is what you are talking about a duplicate of https://github.com/scalameta/metals/issues/6478? This seems to be a bloop issue, so switching to sbt as build server might be a temporary solution, until we figure out why this is happening.