Vscode: Quick-fix import not working

Created on 12 Jul 2019  Â·  18Comments  Â·  Source: microsoft/vscode

After my VSCode updated to 1.36, my quick fix to add imports for Java files in a maven project is not working. Not sure if this is in VSCode, or on the Java extension side.
image
The menu pops up, and I can click it, but nothing happens. No import line is added to the top of the file.

VSCode about
Version: 1.36.1 (user setup)
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:59:35.033Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

*duplicate javascript

Most helpful comment

Quick fixes triggered by clicking on the lichtbulb icon seem to work 100%, but when hovering over a red squigle, and selecting quick fix from the tooltip that pops up is not working. Pressing ctrl+. and selecting for example the import missing reference works as well. It's just the hover popup that is not responding.

All 18 comments

Can you please include a list of Extensions (related to java and maven) you are currently using, this could just be the extension malfunctioning with the new release 1.36.1

I have the following extensions installed:
Debugger for Java (vscjava.vscode-java-debug 0.20.0)
Java Dependency Viewer (vscjava.vscode-java-dependency 0.5.1)
Java Extension Pack (vscjava.vscode-java-pack 0.7.1)
Java Test Runner (vscjava.vscode-java-test 0.18.1)
Language Support for Java(TM) by Red Hat (redhat.java 0.46.0)
Lombok Annotations Support for VS Code (gabrielbb.vscode-lombok 0.9.8)
Maven for Java (vscjava.vscode-maven 0.18.0)
Spring Boot Dashboard (vscjava.vscode-spring-boot-dashboard 0.1.5)
Spring Boot Extension Pack (pivotal.vscode-boot-dev-pack 0.0.8)
Spring Boot Tools (pivotal.vscode-spring-boot 1.9.0)
Spring Initializr Java Support (vscjava.vscode-spring-initializr 0.4.5)
Visual Studio IntelliCode (visualstudioexptteam.vscodeintellicode 1.1.7)

I did not realize there were this many additional packages installed.

I have disabled all extensions and reloaded VSCode, but the problem persists.
The only plugin remaining is: Language Support for Java(TM) by Red Hat (redhat.java 0.46.0), which is needed for the quick fix function to pick up the missing package.

Another note, when selecting the lightbulb in the PROBLEMS window and issuing the same instruction, it works perfectly.

So I tried to reproduce the issue mentioned here, however in my case everything was working perfect and all the imports were added.

✗ Issue isn't reproducable.
System used in reproducing the issue: 18.04.1-Ubuntu

So I tried to reproduce the issue mentioned here, however in my case everything was working perfect and all the imports were added.

✗ Issue isn't reproducable.
System used in reproducing the issue: 18.04.1-Ubuntu

Thanks for trying on Ubuntu's version. Possibly only on Windows 10?
Seems to only be on the pop-up menu that this is not working. None of the quick fix options do anything.

@bpasero can you please add the question label so that vscodebot redirects the user to Stackoverflow.

How are you triggering quick fixes?

Quick fixes triggered by clicking on the lichtbulb icon seem to work 100%, but when hovering over a red squigle, and selecting quick fix from the tooltip that pops up is not working. Pressing ctrl+. and selecting for example the import missing reference works as well. It's just the hover popup that is not responding.

same problem here

Same issue here, Dart-Code/Dart-Code#1860

Definitely seems like the same issue. Thanks. Will be following that thread.

@mjbvz I made a test build for @v0l that has some hard-coded fixes:

const title2 = "Jump to line 1";
const action2 = new vs.CodeAction(title2, vs.CodeActionKind.QuickFix);
action2.command = {
    arguments: [{ lineNumber: 0, at: "top" }],
    command: "revealLine",
    title: title2,
};

return [action, action2];

This didn't work either (I can't reproduce it myself though). It seems like the command is never being invoked when the item is clicked.

Looks like this came up before, and was expected to be fixed? https://github.com/microsoft/vscode/issues/76851

Anything else I can do to assist in finding the issue from my side?
Just to summarize the experience:

  • Hover over error and wait for the popup to appear, click Quick Fix, select import xxxx by clicking, does nothing
  • Hover over error and wait for the popup to appear, click Quick Fix, select import xxxx by using arrows and enter keys, does nothing
  • Click on error, press ctrl+. select import xxxx - works and import is added
  • Click on error and wait for light-bulb to appear, click on that and select import xxxx - works and import is added

Seems to be an interface bug as the functionality is still there and working, but it does not seem like clicking on the menu opened by the mouse hover event triggers the functions to execute the quick fix, but rather just closes the frame.

Another update. Installed VS Code on another windows machine, running Windows 7. Same problem, only here, none of the options for quick fix seems to work.

Quick fixes triggered by clicking on the lichtbulb icon seem to work 100%, but when hovering over a red squigle, and selecting quick fix from the tooltip that pops up is not working. Pressing ctrl+. and selecting for example the import missing reference works as well. It's just the hover popup that is not responding.

Same problem as commented here. Clicking the lightbulb appears to fix, but hovering over a squiggle and clicking on the popup does nothing.
I have the same Java extensions and use Windows 10.
Version: 1.36.1 (user setup)
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:59:35.033Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17134

Duplicate of #77018

Was this page helpful?
0 / 5 - 0 ratings