microsoft / microsoft/vscode-java-pack

After opening a Java file, another file from a different project with same name becomes current file

Offen
#410 4 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@testforstephen arbeitet bereits daran.

Seit 29.5.2020.

ai-triaged bug question
Vorherrschende Sprache
TypeScript
Sterne
352
Forks
166
Ø Merge
17 Std. 47 Min.
Gemergte PRs (30 T.)
32

Beschreibung

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:

  1. CTRL+SHIFT+P and selected "Java: Create New Project"
  2. Selected directory /home/username/Java
  3. Chose project name "HelloWorld"
    (Directory /home/username/Java/HelloWorld was created with default subdirectories and files, including ./src/App.java)
  4. CTRL+SHIFT+P and selected "Java: Create New Project"
  5. Selected directory /home/username/Java
  6. Chose project name "GoodbyeWorld"
    (Directory /home/username/Java/GoodbyeWorld was created with default subdirectories and files, including ./src/App.java)
  7. 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!"); } }
  8. Exited and reopened Visual Studio Code
  9. Navigated to the "GoodbyeWorld" project in the Explorer and opened "App.java"
  10. 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:

another-file-becomes-current-file

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.