microsoft / microsoft/vscode-java-pack
After opening a Java file, another file from a different project with same name becomes current file
@testforstephen ci sta già lavorando.
Dal 29/5/2020.
- Lingua principale
- TypeScript
- Stelle
- 352
- Fork
- 166
- Merge medio
- 17h 47m
- PR unite (30g)
- 32
Descrizione
After creating two new projects using "Java: Create New Project", opening the default "App.java" of the second project and running it from the CodeLens options results in the "App.java" from the first project being run. The first project shows as the "current file" in the explorer (it is in yellow text) even though the second project was the one opened from Explorer. I have attached a GIF demonstrating the issue, with reproduction steps below.
I am using Visual Studio Code 1.45.1 + WSL Ubuntu (20.04 LTS build 20200423) with the Remote - WSL and the Java Extension Packs installed.
Reproduced with the following steps:
- CTRL+SHIFT+P and selected "Java: Create New Project"
- Selected directory /home/username/Java
- Chose project name "HelloWorld"
(Directory /home/username/Java/HelloWorld was created with default subdirectories and files, including ./src/App.java) - CTRL+SHIFT+P and selected "Java: Create New Project"
- Selected directory /home/username/Java
- Chose project name "GoodbyeWorld"
(Directory /home/username/Java/GoodbyeWorld was created with default subdirectories and files, including ./src/App.java) - Modified file /home/username/Java/GoodbyeWorld/src/App.java to print "Goodbye, World!" to the console (instead of "Hello, World!")
public class App { public static void main(String[] args) throws Exception { System.out.println("Goodbye, World!"); } } - Exited and reopened Visual Studio Code
- Navigated to the "GoodbyeWorld" project in the Explorer and opened "App.java"
- Confirmed the code should print "Goodbye, World!" and clicked the "Run" CodeLens option
Output: "Hello, World!"
Explorer now shows the HelloWorld project is in yellow text, and navigating the subdirectories shows /home/username/Java/HelloWorld/src/App.java is highlighted
I am new to Visual Studio Code, I apologize if this is simply a configuration error on my part. I followed the https://code.visualstudio.com/docs/remote/wsl and https://code.visualstudio.com/docs/java/java-tutorial for my setup.
Video demonstration:

Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.