Ammonite icon indicating copy to clipboard operation
Ammonite copied to clipboard

Wrong SemanticDB position for first line of script…

Open alexarchambault opened this issue 5 years ago • 3 comments
trafficstars

…if it contains a comment or an empty line first.

For example, in the coursier sources, using metals 0.9.0+139-c169b4ce-SNAPSHOT (which pulls Ammonite 2.1.4), doing a go-to-source on Versions.latestFromTag in launcher.sc brings me to this position: Capture d’écran 2020-05-25 à 11 22 24

This is confirmed when manually inspecting the post-processed SemanticDB:

$ metap .ammonite/scala-2.12.11/amm-2.1.4/scripts/shared/Version/target/META-INF/semanticdb/scripts/shared/Version.sc.semanticdb |grep 'Version\.latestFromTag'
ammonite/$file/scripts/shared/Version.latestFromTag(). => method latestFromTag: String
[1:16..1:29): g: String = { <= ammonite/$file/scripts/shared/Version.latestFromTag().

(should be [1:4..1:17) rather than [1:16..1:29)).

alexarchambault avatar May 25 '20 09:05 alexarchambault

FYI @tgodzik, I found conditions under which position errors still happen on the first line… Maybe this is what you saw in https://github.com/scalameta/metals/pull/1538#issuecomment-627462563?

I'll try to find time to fix this here.

alexarchambault avatar May 25 '20 15:05 alexarchambault

Och, that might it! It started to work for me, so I assumed it was fixed.

tgodzik avatar May 25 '20 16:05 tgodzik

so I assumed it was fixed.

It was -partly- fixed.

alexarchambault avatar May 25 '20 16:05 alexarchambault