microsoft / microsoft/vscode-java-debug

VSCode and folders in repository from GitHub

Offen
#785 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

ai-triaged question standalone files
Vorherrschende Sprache
TypeScript
Sterne
591
Forks
429
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
19

Beschreibung

First of all I'm not an expert, but I will try to explain my issue as well as I can. I'm not sure if it's a bug, but I still need help to figure it out.
I was working with a GitHub-repository with standalone .java-files (no Java-project, Maven etc.). I'm a student, and so far we are programming Java by making different classes in different .java-files, that works together by being in the same folder. Then I changed the name of the repository, and added some folders within the repository and moved my .java-files into one of those folders. Then I tried to run the my program, by hitting "run" on in the file that contain my "static void main-method". It then returned a "fileNotFoundException", because the program I coded was trying to read from a .txt-file inside the folder. The program had worked before I renamed the repository and moved the files into the folder. After some googling, I found out that the issue was that I moved the .txt file, and that this could be fixed by deleting the directory "Library/Application Support/Code/User/workspaceStorage". So I did, and it didn't fix the problem, and created another problem, which is now the problem that I need help with. When I open my GitHub-repository (which I have cloned to my Mac) in VSCode it opens fine, and I can open the folders inside the repository in the file-explorer in VSCode. But when I open one of the .java-files within one of those folders, it seems like VSCode sets this folder to a main folder or something, because when I go into one of those other folders inside the repository, and open one of the .java files there, then VSCode says that "filename.java is not on the classpath of project nameOfProject, only syntax errors are reported". But I have not created a project or anything, I just have .java-files inside the same folder, and they work together that way. So how do I fix this issue, because I didn't have a problem with this before, and it reported all sort of errors, not only syntax error

Environment
  • Operating System: MacOS 10.15.4
  • JDK version: 1.8.0_231
  • Visual Studio Code version: 1.43.2
  • Java extension version: 0.8.1
  • Java Debugger extension version: 0.25.1
Steps To Reproduce
  1. Open my GitHub-repository that has been cloned to my computer.
  2. Open a .java-file within a subfolder in the repository.
  3. Open a .java-file inside another of the subfolders in the repository.
  4. Try to run a file with static void main-method in it.

[attach a sample project reproducing the error]
[attach logs]
I try to add a logg here, hope this is the correct one

Current Result
Expected Result
Additional Informations

Beitragsleitfaden

Beitragsleitfaden öffnen

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.

Rechercherichtung

Beginne damit, das Verhalten in VS Code 1.43.2 mit der Java extension und der Java Debugger extension zu reproduzieren: Öffne das geklonte Repository, anschließend Java-Dateien in separaten Unterordnern, und führe die Datei aus, die die Methode static void main enthält. Prüfe das verknüpfte Protokoll und die Details von workspaceStorage, um festzustellen, warum Dateien außerhalb des Projekt-Classpaths gemeldet werden; abgeschlossen ist die Aufgabe, wenn eine reproduzierbare Ursache und eine dokumentierte Lösung identifiziert wurden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, typescript, vscode
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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