Auto-import was not triggered automatically in some cases
See original GitHub issueEnvironment
- Operating System: Win/Mac/Linux
- JDK version: 13/12/8
- Visual Studio Code version:1.39.2
- Java extension version:0.51.0
Steps To Reproduce
- Make sure java.actionsOnPaste.organizeImports in settings is true.
- New Foo.java with codes as below:
import java.io.File;
public class Foo {
public static void main(String[] args) {
File f =new File("A.txt");
}
}
Result:
-
If copy the main method to another empty java file Auto-import was not triggered automatically.
-
If copy the all class to another empty java file Auto-import was triggered automatically.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
Auto-import doesn't work · Issue #28 · microsoft/pylance-release
It seems that the auto-import functionality is only triggered when the package name ... The auto-import still is not working in some cases....
Read more >Automatic move of transports not functioning - SAP Community
When the transport is released from DEV, we see it in the queue with a clock icon next to it indicating it is...
Read more >Auto Import of React Components in Visual Studio Code [closed]
My typescript components weren't autoimporting. From your example I noticed baseUrl wasn't present in my tsconfig. Adding that started populating the auto- ......
Read more >Auto Import | IntelliJ IDEA Documentation - JetBrains
Unambiguous imports on the fly With this checkbox selected, IntelliJ IDEA adds import statements when you type your code or paste a fragment ......
Read more >Create chat configuration to auto-import chats
Create a chat configuration to automatically import the chats between the agents and the requesters for additional tables to extend the auto ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The feature is expected to work when pasting into an empty file. It seems you’re trying to paste in a file that already has a class definition, so it’s not empty.
Triggering autoimport when pasting in non-empty files might cause some issues eventually, that’s why I’d prefer not to enable it at this time.
@leonardofel you can install the latest CI build containing the fix, from https://download.jboss.org/jbosstools/jdt.ls/staging/?C=M;O=D