diff --git a/package.json b/package.json index 849a0a5..38729c1 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "scripts": { "format": "prettier -w .", "lint": "eslint src --ext ts", - "typecheck": "tsc --noEmit", + "tsc": "tsc --noEmit", "package": "webpack --mode production --devtool source-map --config ./webpack.config.js", "watch": "webpack --watch", "vsce-package": "vsce package -o ruff.vsix", diff --git a/src/common/server.ts b/src/common/server.ts index b102b4d..c8469e3 100644 --- a/src/common/server.ts +++ b/src/common/server.ts @@ -90,11 +90,11 @@ export async function restartServer( _disposables = []; } const projectRoot = await getProjectRoot(); - const workspaceSetting = await getWorkspaceSettings(serverId, projectRoot, true); + const workspaceSetting = await getWorkspaceSettings(serverId, projectRoot); const newLSClient = await createServer(workspaceSetting, serverId, serverName, outputChannel, { - settings: await getExtensionSettings(serverId, true), - globalSettings: await getGlobalSettings(serverId, false), + settings: await getExtensionSettings(serverId), + globalSettings: await getGlobalSettings(serverId), }); traceInfo(`Server: Start requested.`); _disposables.push( diff --git a/src/common/settings.ts b/src/common/settings.ts index 7ca1b36..23f4515 100644 --- a/src/common/settings.ts +++ b/src/common/settings.ts @@ -26,12 +26,11 @@ export interface ISettings { fixAll: boolean; } -export function getExtensionSettings( - namespace: string, - includeInterpreter?: boolean, -): Promise { +export function getExtensionSettings(namespace: string): Promise { return Promise.all( - getWorkspaceFolders().map((w) => getWorkspaceSettings(namespace, w, includeInterpreter)), + getWorkspaceFolders().map((workspaceFolder) => + getWorkspaceSettings(namespace, workspaceFolder), + ), ); } @@ -65,16 +64,12 @@ export function getInterpreterFromSetting(namespace: string, scope?: Configurati export async function getWorkspaceSettings( namespace: string, workspace: WorkspaceFolder, - includeInterpreter?: boolean, ): Promise { const config = getConfiguration(namespace, workspace.uri); - let interpreter: string[] = []; - if (includeInterpreter) { - interpreter = getInterpreterFromSetting(namespace, workspace) ?? []; - if (interpreter.length === 0) { - interpreter = (await getInterpreterDetails(workspace.uri)).path ?? []; - } + let interpreter: string[] = getInterpreterFromSetting(namespace, workspace) ?? []; + if (interpreter.length === 0) { + interpreter = (await getInterpreterDetails(workspace.uri)).path ?? []; } return { @@ -97,26 +92,14 @@ function getGlobalValue(config: WorkspaceConfiguration, key: string, defaultV return inspect?.globalValue ?? inspect?.defaultValue ?? defaultValue; } -export async function getGlobalSettings( - namespace: string, - includeInterpreter?: boolean, -): Promise { +export async function getGlobalSettings(namespace: string): Promise { const config = getConfiguration(namespace); - - let interpreter: string[] = []; - if (includeInterpreter) { - interpreter = getGlobalValue(config, "interpreter", []); - if (interpreter === undefined || interpreter.length === 0) { - interpreter = (await getInterpreterDetails()).path ?? []; - } - } - return { cwd: process.cwd(), workspace: process.cwd(), args: getGlobalValue(config, "args", []), path: getGlobalValue(config, "path", []), - interpreter: interpreter, + interpreter: [], importStrategy: getGlobalValue(config, "importStrategy", "fromEnvironment"), run: getGlobalValue(config, `run`, "onType"), enable: getGlobalValue(config, `enable`, true),