You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API to programmatically detect if Java Preview features are enabled #3102
I think this is currently possible. If you look at the API you'll see we define a function, getProjectSettings(Uri, string[]) . You can use this with org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures, which is the setting that enables preview features :
const vscodeJava = extensions.getExtension('redhat.java');
if (!vscodeJava) {
throw new Error("VSCode java is not installed");
}
const api = await vscodeJava.activate();
if (!api) {
throw new Error("VSCode java api not found");
}
const projectSetting: {} = await api.getProjectSettings(
Uri.file(path.join('some', 'project', 'path')).toString(),
['org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures']
);
I think you would need to ensure that the language server has imported the project, but there are events like onDidProjectsImport that we provide for that also.
Activity
rgrunber commentedon May 24, 2023
I think this is currently possible. If you look at the API you'll see we define a function,
getProjectSettings(Uri, string[]). You can use this withorg.eclipse.jdt.core.compiler.problem.enablePreviewFeatures, which is the setting that enables preview features :I think you would need to ensure that the language server has imported the project, but there are events like
onDidProjectsImportthat we provide for that also.