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

Code Lens References Keep Turning On and Off? #273

Closed
MatthewMcConnell opened this issue Aug 7, 2017 · 3 comments
Closed

Code Lens References Keep Turning On and Off? #273

MatthewMcConnell opened this issue Aug 7, 2017 · 3 comments

Comments

@MatthewMcConnell
Copy link

Environment
  • Operating System: Windows 10
  • JDK version: 1.8
  • Visual Studio Code version: 1.14.2

Been having problems with the code lens as when I am typing more code I am seeing the references pop away and back again, making the code move as a whole up and down which is quite annoying to see when typing.

Recently I got this error in the output:

[Error - 13:21:58] 07-Aug-2017 13:19:39 Problem resolving code lens
Index out of bounds
Java Model Exception: Java Model Status [Index out of bounds]
at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:158)
at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:377)
at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:371)
at org.eclipse.jdt.ls.core.internal.JDTUtils.findElementsAtSelection(JDTUtils.java:444)
at org.eclipse.jdt.ls.core.internal.JDTUtils.findElementAtSelection(JDTUtils.java:431)
at org.eclipse.jdt.ls.core.internal.handlers.CodeLensHandler.resolve(CodeLensHandler.java:76)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$12(JDTLanguageServer.java:352)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

@fbricon
Copy link
Collaborator

fbricon commented Aug 7, 2017

Yeah code lenses are recomputed every time the document changes, it's not ideal.

You can disable codeLenses in the preferences either via
"editor.codeLens": false //disables all code lenses at the editor level
or
"java.referencesCodeLens.enabled": false //only disables java reference code lenses
"java.implementationsCodeLens.enabled": false //only disable java implementation code lenses

As for the Index Out of Bound exception, I see it occasionally too, I assume there's a race condition between updating the compilation unit during typing and recomputing code lenses. I think this should be handled in a separate ticket

@fbricon fbricon added the bug label Aug 7, 2017
@aeschli
Copy link
Collaborator

aeschli commented Aug 21, 2017

The bug was in VSCode: microsoft/vscode#32877. The fix will be in the August release.

@fbricon
Copy link
Collaborator

fbricon commented Aug 21, 2017

Until the next version of vscode is released, you can try the latest insiders build.

@fbricon fbricon added this to the End August 2017 milestone Aug 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants