Merge pull request #8281 from microsoft/coleng/fix_no_folder_multiroot_install_failure
This commit is contained in:
Коммит
b0a82a8bdc
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче