Skip to content

Commit 1a8a547

Browse files
Skip security warning for workspace settings 'java.home' and 'java.jdt.ls.java.home' in a trusted workspace (#2607)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent 5fa5fbc commit 1a8a547

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export async function checkJavaPreferences(context: ExtensionContext): Promise<{
164164
const key = getKey(IS_WORKSPACE_JLS_JDK_ALLOWED, context.storagePath, javaHome);
165165
const globalState = context.globalState;
166166
if (!isVerified) {
167-
isVerified = globalState.get(key);
167+
isVerified = workspace.isTrusted || globalState.get(key);
168168
if (isVerified === undefined) {
169169
await window.showErrorMessage(`Security Warning! Do you allow this workspace to set the java.jdt.ls.java.home variable? \n java.jdt.ls.java.home: ${javaHome}`, disallow, allow).then(async selection => {
170170
if (selection === allow) {
@@ -191,7 +191,7 @@ export async function checkJavaPreferences(context: ExtensionContext): Promise<{
191191
const key = getKey(IS_WORKSPACE_JDK_ALLOWED, context.storagePath, javaHome);
192192
const globalState = context.globalState;
193193
if (!isVerified) {
194-
isVerified = globalState.get(key);
194+
isVerified = workspace.isTrusted || globalState.get(key);
195195
if (isVerified === undefined) {
196196
await window.showErrorMessage(`Security Warning! Do you allow this workspace to set the java.home variable? \n java.home: ${javaHome}`, disallow, allow).then(async selection => {
197197
if (selection === allow) {

0 commit comments

Comments
 (0)