mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 15:01:57 +01:00
add suggest setting WindowsExecutableExtensions, default values (#238155)
This commit is contained in:
@@ -15,6 +15,8 @@ import { isExecutable } from './helpers/executable';
|
||||
|
||||
const isWindows = osIsWindows();
|
||||
let cachedAvailableCommandsPath: string | undefined;
|
||||
let cachedWindowsExecutableExtensions: Object | undefined;
|
||||
const cachedWindowsExecutableExtensionsSettingId = 'terminal.integrated.suggest.windowsExecutableExtensions';
|
||||
let cachedAvailableCommands: Set<ICompletionResource> | undefined;
|
||||
const cachedBuiltinCommands: Map<string, ICompletionResource[] | undefined> = new Map();
|
||||
|
||||
@@ -110,8 +112,18 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
return result.items;
|
||||
}
|
||||
}, '/', '\\'));
|
||||
}
|
||||
|
||||
if (isWindows) {
|
||||
cachedWindowsExecutableExtensions = vscode.workspace.getConfiguration(cachedWindowsExecutableExtensionsSettingId);
|
||||
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(cachedWindowsExecutableExtensionsSettingId)) {
|
||||
cachedWindowsExecutableExtensions = vscode.workspace.getConfiguration(cachedWindowsExecutableExtensionsSettingId);
|
||||
cachedAvailableCommands = undefined;
|
||||
cachedAvailableCommandsPath = undefined;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the current working directory based on a given prefix if it is a folder.
|
||||
@@ -221,7 +233,7 @@ async function getCommandsInPath(env: { [key: string]: string | undefined } = pr
|
||||
const files = await vscode.workspace.fs.readDirectory(fileResource);
|
||||
for (const [file, fileType] of files) {
|
||||
const formattedPath = getFriendlyFilePath(vscode.Uri.joinPath(fileResource, file), pathSeparator);
|
||||
if (!labels.has(file) && fileType !== vscode.FileType.Unknown && fileType !== vscode.FileType.Directory && await isExecutable(formattedPath)) {
|
||||
if (!labels.has(file) && fileType !== vscode.FileType.Unknown && fileType !== vscode.FileType.Directory && await isExecutable(formattedPath), cachedWindowsExecutableExtensions) {
|
||||
executables.add({ label: file, path: formattedPath });
|
||||
labels.add(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user