diff --git a/src/extension.ts b/src/extension.ts index c44fc601c..1fc901eb6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -225,8 +225,10 @@ export async function activate(context: ExtensionContext): Promise { ); context.subscriptions.push( - vscode.debug.registerDebugConfigurationProvider("ansible", - new AnsibleDebugConfigurationProvider()) + vscode.debug.registerDebugConfigurationProvider( + "ansible", + new AnsibleDebugConfigurationProvider() + ) ); context.subscriptions.push( diff --git a/src/features/utils/commandRunner.ts b/src/features/utils/commandRunner.ts index 8d407cb1a..4a80c5dae 100644 --- a/src/features/utils/commandRunner.ts +++ b/src/features/utils/commandRunner.ts @@ -28,7 +28,11 @@ export function withInterpreter( const activationScript = settings.activationScript; if (activationScript) { - const [command, shellArgs] = wrapWithActivationScript(activationScript, runExecutable, cmdArgs); + const [command, shellArgs] = wrapWithActivationScript( + activationScript, + runExecutable, + cmdArgs + ); return [`${command} ${shellArgs.join(" ")}`, undefined]; } @@ -41,7 +45,7 @@ export function withInterpreter( // emulating virtual environment activation script const venvVars = buildPythonVirtualEnvVars(interpreterPath); - for (let key in venvVars) { + for (const key in venvVars) { newEnv[key] = venvVars[key]; } delete newEnv.PYTHONHOME; @@ -60,14 +64,14 @@ export function withPythonModule( settings: ExtensionSettings, module: string, moduleArgs: string[] -): [string, string[], {[key: string]: string}] { +): [string, string[], { [key: string]: string }] { let command: string = "python"; let commandArgs: string[] = ["-m", module]; commandArgs.push(...moduleArgs); - const newEnv: {[key: string]: string} = {}; - for (let e in process.env) { + const newEnv: { [key: string]: string } = {}; + for (const e in process.env) { newEnv[e] = process.env[e] ?? ""; } @@ -79,10 +83,9 @@ export function withPythonModule( command, commandArgs.join(" ") ); - } - else if (interpreterPath) { + } else if (interpreterPath) { const venvVars = buildPythonVirtualEnvVars(interpreterPath); - for (let key in venvVars) { + for (const key in venvVars) { newEnv[key] = venvVars[key]; } delete newEnv.PYTHONHOME; @@ -104,11 +107,11 @@ export function withPythonModule( function wrapWithActivationScript( activationScript: string, executable: string, - cmdArgs: string, + cmdArgs: string ): [string, string[]] { return [ "bash", - ["-c", `source ${activationScript} && ${executable} ${cmdArgs}`] + ["-c", `source ${activationScript} && ${executable} ${cmdArgs}`], ]; } @@ -118,14 +121,14 @@ function wrapWithActivationScript( * @param interpreterPath The Python interpreter path. * @returns The env vars that need to be set to run in the venv. */ -function buildPythonVirtualEnvVars( - interpreterPath: string, -): { [key: string]: string } { +function buildPythonVirtualEnvVars(interpreterPath: string): { + [key: string]: string; +} { const virtualEnv = path.resolve(interpreterPath, "../.."); const pathEntry = path.join(virtualEnv, "bin"); return { VIRTUAL_ENV: virtualEnv, - PATH: `${pathEntry}${path.delimiter}${process.env.PATH}` + PATH: `${pathEntry}${path.delimiter}${process.env.PATH}`, }; -} \ No newline at end of file +} diff --git a/src/interfaces/extensionSettings.ts b/src/interfaces/extensionSettings.ts index 2579c4224..2c153e873 100644 --- a/src/interfaces/extensionSettings.ts +++ b/src/interfaces/extensionSettings.ts @@ -35,4 +35,4 @@ export interface LightSpeedServiceSettings { export interface DebuggerSettings { logFile: string | null; logLevel: string; -} \ No newline at end of file +}