Merge pull request #8281 from microsoft/coleng/fix_no_folder_multiroot_install_failure

This commit is contained in:
Colen Garoutte-Carson 2021-10-15 13:21:29 -07:00 коммит произвёл GitHub
Родитель 0b94fdefe9 a10a6d28ad
Коммит b0a82a8bdc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -264,7 +264,7 @@ export class CppProperties {
// not for each notifying folder.
const savedDocWorkspaceFolder: vscode.WorkspaceFolder | undefined = vscode.workspace.getWorkspaceFolder(doc.uri);
const notifyingWorkspaceFolder: vscode.WorkspaceFolder | undefined = vscode.workspace.getWorkspaceFolder(vscode.Uri.file(settingsPath));
if ((!savedDocWorkspaceFolder && vscode.workspace.workspaceFolders && notifyingWorkspaceFolder === vscode.workspace.workspaceFolders[0])
if ((!savedDocWorkspaceFolder && vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0 && notifyingWorkspaceFolder === vscode.workspace.workspaceFolders[0])
|| savedDocWorkspaceFolder === notifyingWorkspaceFolder) {
let fileType: string | undefined;
const documentPath: string = doc.uri.fsPath.toLowerCase();

Просмотреть файл

@ -284,7 +284,7 @@ function sendActivationTelemetry(): void {
}
function realActivation(): void {
if (new CppSettings(vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri : undefined).intelliSenseEngine === "Disabled") {
if (new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined).intelliSenseEngine === "Disabled") {
throw new Error(intelliSenseDisabledError);
} else {
console.log("activating extension");

Просмотреть файл

@ -1272,7 +1272,7 @@ function getUniqueWorkspaceNameHelper(workspaceFolder: vscode.WorkspaceFolder, a
return workspaceFolderName; // No duplicate names to search for.
}
for (let i: number = 0; i < workspaceFolder.index; ++i) {
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[i].name === workspaceFolderName) {
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0 && vscode.workspace.workspaceFolders[i].name === workspaceFolderName) {
return addSubfolder ? path.join(workspaceFolderName, String(workspaceFolder.index)) : // Use the index as a subfolder.
workspaceFolderName + String(workspaceFolder.index);
}

Просмотреть файл

@ -393,7 +393,7 @@ async function postInstall(info: PlatformInformation): Promise<void> {
}
async function finalizeExtensionActivation(): Promise<void> {
const settings: CppSettings = new CppSettings(vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri : undefined);
const settings: CppSettings = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined);
if (settings.intelliSenseEngine === "Disabled") {
languageServiceDisabled = true;
getTemporaryCommandRegistrarInstance().disableLanguageServer();