Skip to content

Commit c19acec

Browse files
committed
Pass the workspace path to onConfigurationChange()
Signed-off-by: sheche <sheche@microsoft.com>
1 parent bdf8314 commit c19acec

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/extension.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ let storagePath: string;
3636
let clientLogFile: string;
3737

3838
export const cleanWorkspaceFileName = '.cleanWorkspace';
39-
export let workspacePath: string;
4039

4140
export class ClientErrorHandler implements ErrorHandler {
4241
private restarts: number[];
@@ -193,7 +192,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
193192
}).then(async (requirements) => {
194193
const triggerFiles = await getTriggerFiles();
195194
return new Promise<ExtensionAPI>(async (resolve) => {
196-
workspacePath = path.resolve(storagePath + '/jdt_ws');
195+
const workspacePath = path.resolve(storagePath + '/jdt_ws');
197196
const syntaxServerWorkspacePath = path.resolve(storagePath + '/ss_ws');
198197

199198
let serverMode = getJavaServerMode();
@@ -370,7 +369,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
370369

371370
context.subscriptions.push(commands.registerCommand(Commands.CLEAN_WORKSPACE, () => cleanWorkspace(workspacePath)));
372371

373-
context.subscriptions.push(onConfigurationChange());
372+
context.subscriptions.push(onConfigurationChange(workspacePath));
374373

375374
/**
376375
* Command to switch the server mode. Currently it only supports switch from lightweight to standard.

src/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as fs from 'fs';
44
import * as path from 'path';
55
import { window, Uri, workspace, WorkspaceConfiguration, commands, ConfigurationTarget, env, ExtensionContext, TextEditor, Range, Disposable, WorkspaceFolder } from 'vscode';
66
import { Commands } from './commands';
7-
import { cleanWorkspaceFileName, workspacePath } from './extension';
7+
import { cleanWorkspaceFileName } from './extension';
88
import { ensureExists, getJavaConfiguration } from './utils';
99

1010
const DEFAULT_HIDDEN_FILES: string[] = ['**/.classpath', '**/.project', '**/.settings', '**/.factorypath'];
@@ -25,7 +25,7 @@ export const ORGANIZE_IMPORTS_ON_PASTE = 'actionsOnPaste.organizeImports'; // ja
2525
let oldConfig: WorkspaceConfiguration = getJavaConfiguration();
2626
const gradleWrapperPromptDialogs = [];
2727

28-
export function onConfigurationChange() {
28+
export function onConfigurationChange(workspacePath: string) {
2929
return workspace.onDidChangeConfiguration(params => {
3030
if (!params.affectsConfiguration('java')) {
3131
return;

0 commit comments

Comments
 (0)