question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code-completion not working with Language Support for Java and Visual Studio IntelliCode - Preview

See original GitHub issue

Issue Type: Bug

Not sure if this belongs to LSfJ or is an Visual Studio IntelliCode Issue.

VScode fails to show code-completion on fields. This happens if Language Support for Java and Visual Studio IntelliCode - Preview are installed AND "java.implementationsCodeLens.enabled": true is NOT set in settings.json.

Instead of showing the suggestions only an exception is thrown.

Peek 2019-03-17 23-33

Extension version: 0.41.0 VS Code version: Code 1.32.3 (a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4, 2019-03-14T23:38:49.842Z) OS version: Linux x64 4.20.15-1-MANJARO

settings.json
{
    "window.titleBarStyle": "custom",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "java.referencesCodeLens.enabled": true,
    // "java.implementationsCodeLens.enabled": true
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>spcified</groupId>
  <artifactId>test-vs-code</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>test-vs-code</name>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
Extensions Log
[2019-03-17 23:50:50.915] [exthost] [info] extension host started
[2019-03-17 23:50:50.957] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"activationEvent":"*"}
[2019-03-17 23:50:50.958] [exthost] [info] ExtensionService#loadCommonJSModule /opt/visual-studio-code/resources/app/extensions/debug-auto-launch/dist/extension
[2019-03-17 23:50:50.961] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"activationEvent":"*"}
[2019-03-17 23:50:50.961] [exthost] [info] ExtensionService#loadCommonJSModule /opt/visual-studio-code/resources/app/extensions/emmet/dist/extension
[2019-03-17 23:50:50.968] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"activationEvent":"*"}
[2019-03-17 23:50:50.968] [exthost] [info] ExtensionService#loadCommonJSModule /opt/visual-studio-code/resources/app/extensions/git/dist/main
[2019-03-17 23:50:51.004] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"activationEvent":"*"}
[2019-03-17 23:50:51.004] [exthost] [info] ExtensionService#loadCommonJSModule /opt/visual-studio-code/resources/app/extensions/merge-conflict/dist/extension
[2019-03-17 23:50:51.008] [exthost] [info] ExtensionService#_doActivateExtension redhat.java {"startup":false,"activationEvent":"onLanguage:java"}
[2019-03-17 23:50:51.008] [exthost] [info] ExtensionService#loadCommonJSModule /home/wusluf/.vscode/extensions/redhat.java-0.41.0/dist/extension
[2019-03-17 23:50:51.022] [exthost] [info] ExtensionService#_doActivateExtension VisualStudioExptTeam.vscodeintellicode {"startup":false,"activationEvent":"onLanguage:java"}
[2019-03-17 23:50:51.022] [exthost] [info] ExtensionService#loadCommonJSModule /home/wusluf/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.1.4/dist/intellicode
[2019-03-17 23:50:58.544] [exthost] [info] eager extensions activated
Language Server Log
!SESSION 2019-03-17 23:50:51.525 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_202
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data /home/wusluf/.config/Code/User/workspaceStorage/cc225f46f4cba87c7cd345dbcfbf8b78/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:54.652
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:54.828
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:54.868
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:54.869
!MESSAGE Initializing Java Language Server 0.35.0.201903150009

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:54.925
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:54.968
!MESSAGE Creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:56.018
!MESSAGE Finished creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:56.477
!MESSAGE Importing Maven project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:58.537
!MESSAGE Workspace initialized in 3647ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:58.934
!MESSAGE >> workspace/didChangeConfiguration

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:58.955
!MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles'

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:58.970
!MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles'

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:59.035
!MESSAGE >>New configuration: {java={home=null, jdt={ls={vmargs=-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication}}, errors={incompleteClasspath={severity=warning}}, configuration={checkProjectSettingsExclusions=true, updateBuildConfiguration=automatic, maven={userSettings=null}}, trace={server=off}, import={gradle={enabled=true}, maven={enabled=true}, exclusions=[**/node_modules/**, **/.metadata/**, **/archetype-resources/**, **/META-INF/maven/**]}, referencesCodeLens={enabled=true}, signatureHelp={enabled=false}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=null, profile=null}, comments={enabled=true}, onType={enabled=true}}, saveActions={organizeImports=false}, contentProvider={preferred=null}, autobuild={enabled=true}, maxConcurrentBuilds=1.0, completion={enabled=true, overwrite=true, guessMethodArguments=false, favoriteStaticMembers=[org.junit.Assert.*, org.junit.Assume.*, org.junit.jupiter.api.Assertions.*, org.junit.jupiter.api.Assumptions.*, org.junit.jupiter.api.DynamicContainer.*, org.junit.jupiter.api.DynamicTest.*, org.mockito.Mockito.*, org.mockito.ArgumentMatchers.*, org.mockito.Answers.*], importOrder=[java, javax, com, org]}, progressReports={enabled=true}, codeGeneration={hashCodeEquals={useJava7Objects=false, useInstanceof=false, useBlocks=false, generateComments=false}}}}

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:59.047
!MESSAGE >> document/didOpen

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:59.321
!MESSAGE >> workspace/executeCommand java.intellicode.enable

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:59.343
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:50:59.365
!MESSAGE >> document/codeLens

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:00.715
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:01.630
!MESSAGE begin problem for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:01.631
!MESSAGE 1 problems reported for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:01.633
!MESSAGE Reconciled 0, validated: 1. Took 1181 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:02.074
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:02.213
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:02.215
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:02.216
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.317
!MESSAGE >> document/didChange

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.515
!MESSAGE >> document/codeLens

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.766
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.766
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.767
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.880
!MESSAGE begin problem for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.881
!MESSAGE 2 problems reported for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:03.883
!MESSAGE Reconciled 0, validated: 1. Took 112 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:04.461
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:04.462
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:04.463
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.198
!MESSAGE >> document/didChange

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.403
!MESSAGE >> document/codeLens

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.407
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.657
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.658
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.658
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.718
!MESSAGE begin problem for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.732
!MESSAGE 1 problems reported for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.736
!MESSAGE Reconciled 0, validated: 1. Took 79 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:06.992
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:07.372
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:08.327
!MESSAGE >> document/didChange

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:08.561
!MESSAGE >> document/codeLens

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:08.563
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:08.792
!MESSAGE begin problem for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:08.792
!MESSAGE 2 problems reported for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:08.795
!MESSAGE Reconciled 0, validated: 1. Took 63 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.068
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.214
!MESSAGE >> document/didChange

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.282
!MESSAGE >> workspace/executeCommand java.intellicode.completion

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.417
!MESSAGE >> document/codeLens

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.421
!MESSAGE >> document/codeAction

!ENTRY com.microsoft.jdtls.intellicode.core 4 0 2019-03-17 23:51:09.431
!MESSAGE Problem with codeComplete for file:///home/wusluf/projects/learning/JMH%20-%20clean%20project/test-vs-code/src/main/java/spcified/App.java
!STACK 0
java.lang.ClassCastException: org.eclipse.jdt.internal.codeassist.impl.AssistSourceField cannot be cast to org.eclipse.jdt.core.IMethod
	at com.microsoft.jdtls.intellicode.core.pythia.PythiaCompletionContext.getMethodDeclaration(PythiaCompletionContext.java:185)
	at com.microsoft.jdtls.intellicode.core.pythia.PythiaCompletionContext.getCalls(PythiaCompletionContext.java:176)
	at com.microsoft.jdtls.intellicode.core.pythia.PythiaCompletionProvider.provideCompletionItems(PythiaCompletionProvider.java:59)
	at com.microsoft.jdtls.intellicode.core.CompletionProvider.computeContentAssist(CompletionProvider.java:117)
	at com.microsoft.jdtls.intellicode.core.CompletionProvider.provideCompletionItems(CompletionProvider.java:60)
	at com.microsoft.jdtls.intellicode.core.CommandHandler.executeCommand(CommandHandler.java:57)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:151)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:141)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:455)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$30(JDTLanguageServer.java:821)
	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)

!ENTRY com.microsoft.jdtls.intellicode.core 1 0 2019-03-17 23:51:09.434
!MESSAGE Completion request cancelled

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.651
!MESSAGE begin problem for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.652
!MESSAGE 1 problems reported for /App.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.654
!MESSAGE Reconciled 0, validated: 1. Took 37 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.671
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.672
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.674
!MESSAGE >> codeLens/resolve

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:09.923
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-03-17 23:51:10.240
!MESSAGE >> codeLens/resolve
Language Supprt for Java Output
[Error - 11:51:09 PM] Mar 17, 2019 11:51:09 PM Problem with codeComplete for file:///home/wusluf/projects/learning/JMH%20-%20clean%20project/test-vs-code/src/main/java/spcified/App.java
org.eclipse.jdt.internal.codeassist.impl.AssistSourceField cannot be cast to org.eclipse.jdt.core.IMethod
java.lang.ClassCastException: org.eclipse.jdt.internal.codeassist.impl.AssistSourceField cannot be cast to org.eclipse.jdt.core.IMethod
	at com.microsoft.jdtls.intellicode.core.pythia.PythiaCompletionContext.getMethodDeclaration(PythiaCompletionContext.java:185)
	at com.microsoft.jdtls.intellicode.core.pythia.PythiaCompletionContext.getCalls(PythiaCompletionContext.java:176)
	at com.microsoft.jdtls.intellicode.core.pythia.PythiaCompletionProvider.provideCompletionItems(PythiaCompletionProvider.java:59)
	at com.microsoft.jdtls.intellicode.core.CompletionProvider.computeContentAssist(CompletionProvider.java:117)
	at com.microsoft.jdtls.intellicode.core.CompletionProvider.provideCompletionItems(CompletionProvider.java:60)
	at com.microsoft.jdtls.intellicode.core.CommandHandler.executeCommand(CommandHandler.java:57)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:151)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:141)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:455)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$30(JDTLanguageServer.java:821)
	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)
System Info
Item Value
CPUs Intel® Core™ i3-3110M CPU @ 2.40GHz (4 x 1955)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
surface_synchronization: enabled_on
video_decode: unavailable_off
webgl: enabled
webgl2: enabled
Load (avg) 1, 1, 1
Memory (System) 7.49GB (0.57GB free)
Process Argv
Screen Reader no
VM 0%

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ahmedhamdy2121commented, Jan 7, 2021

@ahmedhamdy90 See if #923 (comment) helps.

@Eskibear I did ask him about how to fix that (update the lookup path). However, I don’t think it will help because hovering over a function shows the documentation correctly, but it is not showing any on code completion.

1reaction
muggellcommented, May 15, 2019

@Eskibear That’s my conclusion too. But I’d love for you to help me creating a new issue so that I might be able to get it working properly, and hopefully get a stabile solution. It’s really driving me crazy, so I’d appreciate all the help I can get.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode not suggesting and autocompleting java code
This problem might occur if you're using an older version of Java (below 11). To fix this: Open VScode and go to Preferences...
Read more >
IntelliSense in Visual Studio Code
Troubleshooting. If you find IntelliSense has stopped working, the language service may not be running. Try restarting VS Code and this should solve...
Read more >
Visual Studio IntelliCode - Microsoft
With this preview feature, you can build a team model to provide recommendations on code that isn't in the open source domain, such...
Read more >
Java Gets AI-Assisted IntelliCode in Visual Studio Code Editor
In addition to providing the most likely code completion items based on code context, Microsoft in July also announced IntelliCode had gotten ...
Read more >
Code completion | IntelliJ IDEA Documentation - JetBrains
Techniques to accelerate the editing process in IntelliJ IDEA using code completion (basic completion, smart completion based on type, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found