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

On some errors metals spawning multiply Open Doctor questions dialogs and stealing focus from user. #6988

Open
strobe opened this issue Nov 29, 2024 · 5 comments
Labels
bloop Bloop related tickets bug Something that is making a piece of functionality unusable upstream-fix-needed Waiting on a fix upstream

Comments

@strobe
Copy link
Contributor

strobe commented Nov 29, 2024

Describe the bug

I seen this behavior multiply times in different version but would like to provide some details on recent one.

Usually it happens with editing project build definition (in my case build.sc, but I seen same happen with build.sbt too).

On file save the 'Open Doctor' dialog appears and then editor focus moving to it. But issue that it's not only stealing focus but also that it's creating about 5 dialogs at same time and user required to click on each one to close it. Also, after those dialogs will appears on next file safe again (no matter how much time since previous save).
image

So basically with that almost not possible to edit any build files. I seen that also happening with usual code but that definitely more rare cases, seems build file editing triggering that almost always.

@dos65 tried to check issue little bit, he provided this patch dos65@db5e731

and with metals version compiled from that branch following messages found in lsp-client log:

[eglot] Server reports (type=2): Bloop 1 : Referring to non-existent method static org.scalajs.testing.bridge.Bridge.start()void
[eglot] Server reports (type=2): Bloop 2 : called from core module module initializers
[eglot] Server reports (type=2): Bloop 3 : Referring to non-existent class org.scalajs.testing.bridge.Bridge
[eglot] Server reports (type=2): Bloop 3 : called from core module module initializers
[eglot] Server reports (type=2): Bloop 4 : JavaScript linking failed with 'There were linking errors'
[eglot] Server reports (type=2): Bloop 4 : Referring to non-existent method static org.scalajs.testing.bridge.Bridge.start()void
[eglot] Server reports (type=2): Bloop 4 : called from core module module initializers
[eglot] Server reports (type=2): Bloop 4 : Referring to non-existent class org.scalajs.testing.bridge.Bridge
[eglot] Server reports (type=2): Bloop 4 : called from core module module initializers
[eglot] Server reports (type=2): Bloop 4 : JavaScript linking failed with 'There were linking errors'
[eglot] Server reports (type=2): Bloop 4 : Referring to non-existent method static org.scalajs.testing.bridge.Bridge.start()void
[eglot] Server reports (type=2): Bloop 4 : called from core module module initializers
[eglot] Server reports (type=2): Bloop 4 : Referring to non-existent class org.scalajs.testing.bridge.Bridge
[eglot] Server reports (type=2): Bloop 4 : called from core module module initializers
[eglot] Server reports (type=2): Bloop 4 : JavaScript linking failed with 'There were linking errors'

Also following error presented in metals.log

2024.11.28 16:54:18 WARN  Unable to run doctor. Make sure `isHttpEnabled` is set to `true`. [0m
2024.11.28 16:54:27 ERROR unexpected error during source scanning
scala.meta.internal.tokenizers.package$UnexpectedInputEndException
  at scala.meta.internal.tokenizers.LegacyScanner.$anonfun$nextToken$1(LegacyScanner.scala:172)
  at scala.Function0.apply$mcV$sp(Function0.scala:42)
  at scala.meta.internal.tokenizers.LegacyScanner.scala$meta$internal$tokenizers$LegacyScanner$$nextToken(LegacyScanner.scala:178)
  at scala.meta.internal.tokenizers.LegacyScanner.nextToken(LegacyScanner.scala:172)
  at scala.meta.internal.mtags.ScalaToplevelMtags$XtensionScanner.mtagsNextToken(ScalaToplevelMtags.scala:76)
  at scala.meta.internal.mtags.ScalaToplevelMtags.loop$3(ScalaToplevelMtags.scala:966)
  at scala.meta.internal.mtags.ScalaToplevelMtags.acceptWhileIndented(ScalaToplevelMtags.scala:980)
  at scala.meta.internal.mtags.ScalaToplevelMtags.loop(ScalaToplevelMtags.scala:365)
  at scala.meta.internal.mtags.ScalaToplevelMtags.indexRoot(ScalaToplevelMtags.scala:88)
  at scala.meta.internal.mtags.MtagsIndexer.index(MtagsIndexer.scala:21)
  at scala.meta.internal.mtags.MtagsIndexer.index$(MtagsIndexer.scala:20)
  at scala.meta.internal.mtags.ScalaToplevelMtags.index(ScalaToplevelMtags.scala:48)
  at scala.meta.internal.mtags.Mtags.indexWithOverrides(Mtags.scala:74)
  at scala.meta.internal.mtags.SymbolIndexBucket.indexSource(SymbolIndexBucket.scala:129)
  at scala.meta.internal.mtags.SymbolIndexBucket.addSourceFile(SymbolIndexBucket.scala:108)
  at scala.meta.internal.mtags.SymbolIndexBucket.$anonfun$addSourceJar$2(SymbolIndexBucket.scala:72)
  at scala.collection.immutable.List.flatMap(List.scala:294)
  at scala.meta.internal.mtags.SymbolIndexBucket.$anonfun$addSourceJar$1(SymbolIndexBucket.scala:70)
  at scala.meta.internal.io.PlatformFileIO$.withJarFileSystem(PlatformFileIO.scala:77)
  at scala.meta.internal.io.FileIO$.withJarFileSystem(FileIO.scala:33)
  at scala.meta.internal.mtags.SymbolIndexBucket.addSourceJar(SymbolIndexBucket.scala:68)
  at scala.meta.internal.mtags.OnDemandSymbolIndex.$anonfun$addSourceJar$2(OnDemandSymbolIndex.scala:85)
...

Env

Editor

Emacs 29.4 (with doom-emacs)

Lsp client

eglot

OS

Linux (NixOS 24.05)

jdk

openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9)
OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode, sharing)

build tool

mill 0.12.1
(with scala project which included ScalaJS usage)

Expected behavior

editor never steal focus from user (except new project opening case)

Operating system

Linux

Editor/Extension

Emacs (other)

Version of Metals

v1.4.1, v1.4.2

Extra context or search terms

doctor

@strobe
Copy link
Contributor Author

strobe commented Nov 29, 2024

forgot to mention that even when that Open Doctor dialog main Metals functionality working as expected (auto competition works)

@tgodzik
Copy link
Contributor

tgodzik commented Nov 29, 2024

I think that should already be fixed in #6960

You should also be able to change the client configuration the same way in the current version

@tgodzik tgodzik added the needs more information Use if we need more information for a specific ticket label Nov 29, 2024
@strobe
Copy link
Contributor Author

strobe commented Nov 29, 2024

just tested it (without any extra client configuration) via 'quick-publish-local' and that doesn't change behavior in any way, 'Open Doctor' still appears and still spawning multiply requests.

@tgodzik
Copy link
Contributor

tgodzik commented Nov 29, 2024

Ach, right! I only had a quick look at the issue and didn't realize this is a different things altogether.

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable bloop Bloop related tickets upstream-fix-needed Waiting on a fix upstream and removed needs more information Use if we need more information for a specific ticket labels Nov 29, 2024
@tgodzik
Copy link
Contributor

tgodzik commented Nov 29, 2024

We need to fix one issue upstream in Bloop and provide a way of disabling the pop up for users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloop Bloop related tickets bug Something that is making a piece of functionality unusable upstream-fix-needed Waiting on a fix upstream
Projects
None yet
Development

No branches or pull requests

2 participants