Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs';
export const PYTHON_EXTENSION_ID = 'ms-python.python';
export const CONDA_MANAGER_ID = `${PYTHON_EXTENSION_ID}:conda`;
export const INLINE_SCRIPT_MANAGER_ID = `${PYTHON_EXTENSION_ID}:inline-script`;
export const PYENV_MANAGER_ID = `${PYTHON_EXTENSION_ID}:pyenv`;
export const JUPYTER_EXTENSION_ID = 'ms-toolsai.jupyter';
export const EXTENSION_ROOT_DIR = path.dirname(__dirname);
export const ISSUES_URL = 'https://github.com/microsoft/vscode-python-environments/issues';
Expand Down
5 changes: 1 addition & 4 deletions src/common/inlineScriptCacheLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Uri } from 'vscode';
import type { PythonEnvironment } from '../api';
import { INLINE_SCRIPT_MANAGER_ID } from './constants';
import { traceWarn } from './logging';
import { isFileNotFoundError } from './utils/filesystem';
import { normalizePath } from './utils/pathUtils';
import { isWindows } from './utils/platformUtils';
import { getVenvPythonPath } from './utils/virtualEnvironment';
Expand Down Expand Up @@ -273,10 +274,6 @@ function parsePyvenvHome(raw: string): string | undefined {
return undefined;
}

function isFileNotFoundError(err: unknown): boolean {
return typeof err === 'object' && err !== null && 'code' in err && (err as NodeJS.ErrnoException).code === 'ENOENT';
}

function isDescendantPath(rootPath: string, candidatePath: string): boolean {
const relative = path.relative(rootPath, candidatePath);
return (
Expand Down
11 changes: 11 additions & 0 deletions src/common/utils/filesystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

export function isFileNotFoundError(error: unknown): error is NodeJS.ErrnoException {
return (
typeof error === 'object' &&
error !== null &&
'code' in error &&
(error as NodeJS.ErrnoException).code === 'ENOENT'
);
}
11 changes: 10 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,16 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
'poetry',
registerPoetryFeatures(nativeFinder, context.subscriptions, outputChannel, projectManager),
),
safeRegister('inlineScript', registerInlineScriptFeatures(context.subscriptions, outputChannel)),
safeRegister(
'inlineScript',
registerInlineScriptFeatures(
nativeFinder,
context.subscriptions,
outputChannel,
sysMgr,
context.globalStorageUri,
),
),
safeRegister('shellStartupVars', shellStartupVarsMgr.initialize()),
]);

Expand Down
Loading
Loading