Closed sid-srini closed 3 months ago
Additionally, even after using the Workaround given above i.e. manually adding the runConfig settings, the VS Code editor continues to show the same code Problem; although no other issues arise and neither are any Quick Fixes suggested.
This latter behaviour appears to be related to some of the changes done for resolving NetBeans issue #7382.
This may be fixed in org.netbeans.modules.java.lsp.server.singlesourcefile.SingleFileOptionsQueryImpl
of the netbeans project java.lsp.server
, by associating a single source file with any available workspace
which has no client workspace folders. NetBeans PR #7609
Summary
When a Java file is opened directly in the VS Code editor, without opening a folder or a workspace file, then the Quick Fix actions, such as Enable Preview Feature, are unable to save the
runConfig
options in the global settings.Steps to Reproduce
main
method directly in VS Code using the Open menu action or from Finder/Explorer.main
method.implicitly declared classes are a preview feature and are disabled by default
,runConfig
settings are updated.Impact
The Quick Fix actions which require modifying the
runConfig
global extension settings do not seem to run and validation of the Java application continues to fail.Workaround
Manually edit the global settings with the required changes. Example:
"jdk.runConfig.vmOptions": "--source 22 --enable-preview"
Fix Request
The
runConfig
global settings should get modified by the Quick Fix actions, such as, Enable Preview Feature even for non-workspace opened Java files. This will help in quickly trying out new preview features in single-file Java code without setting up a separate test folder or workspace, or, manually edit settings which only advanced users may do.