-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve support for "standalone file" use cases #1270
Comments
@anthonyvdotbe thanks for sharing your thoughts on the "standalone file" support. We're revisiting the UX for this part, too. At first, let me clarify the current support on the "standalone file". The extension provides two kinds of support for the "standalone file".
When you open an arbitrary Java file in VS Code, for example, invoke "Open File..." menu or drag a file to VS Code. The extension will support your file with syntax mode. When opening a single file in VS Code, we infer there are two intentions: read-only and edit/run. For read-only users, show lots of red errors will affect the reading experience. But for the editing users like your 1st use case, providing semantic errors are also necessary and helpful. So we're thinking to provide a switch in the editor to allow the user to enable semantic errors for the current file, so that the user can determine to show the semantic errors on demand.
Then go back to the use cases you mentioned.
|
@testforstephen thanks for pointing out the existence of Project mode, that's really useful
Yes, a switch for enabling semantic errors would be great. |
Thanks to @testforstephen , we now have an improved syntax mode for non-project Java files:
|
Thank you for adding the option to "Only report syntax errors for any non-project file in current session" Is there a way to completely hide the warning that says "xxx.java is a non-project file, only syntax errors are reported"? Now that I am aware that only syntax errors will be reported, the error is no longer actionable. |
When working with standalone files, the "Classpath is incomplete" warning shows up and only syntax errors are reported.
There are several use cases for standalone files, such as:
java Test.java
). This is useful for quickly trying things out, but is also a use case for people who just get started learning Java and don't use projects (and may not even have learned about the classpath/modulepath yet).In all these use cases, I'd like VS Code to compile the file as usual with an empty class- and modulepath. I believe the first 2 use cases don't need further motivation, since it's the natural thing to do.
For the 3rd use case, I disagree with the wiki when it says:
I don't perceive the errors as distracting: in a typical case, most of them are in the imports. The wiki page uses test classes with lots of static imports, which results in a lot more errors, but this is not a typical case. (Ideally, the extension would ask if it should look for a Maven/Gradle/Eclipse file in any of the file's parent folders, such that there wouldn't be any errors at all. In that case, the "Classpath is incomplete" warning would only be given if no such file could be found, which would be very rare, imho.)
Environment
The text was updated successfully, but these errors were encountered: