diff --git a/Extension/.vscode/launch.json b/Extension/.vscode/launch.json index a0ec326742..e52864f10d 100644 --- a/Extension/.vscode/launch.json +++ b/Extension/.vscode/launch.json @@ -98,7 +98,7 @@ "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "${workspaceFolder}/test/integrationTests/testAssets/SimpleCppProject", + "${workspaceFolder}/test/integrationTests/testAssets/SimpleCppProject/simpleCppProject.code-workspace", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test/integrationTests/languageServer/index" ], diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 6f7826b445..0ee7e158f2 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -705,7 +705,7 @@ export class DefaultClient implements Client { constructor(allClients: ClientCollection, workspaceFolder?: vscode.WorkspaceFolder) { this.rootFolder = workspaceFolder; - this.rootRealPath = this.RootPath ? fs.realpathSync(this.RootPath) : ""; + this.rootRealPath = this.RootPath ? (fs.existsSync(this.RootPath) ? fs.realpathSync(this.RootPath) : this.RootPath) : ""; let storagePath: string | undefined; if (util.extensionContext) { const path: string | undefined = util.extensionContext.storageUri?.fsPath; diff --git a/Extension/test/integrationTests/languageServer/runTest.ts b/Extension/test/integrationTests/languageServer/runTest.ts index bddcd5c1e8..a1f32c5da3 100644 --- a/Extension/test/integrationTests/languageServer/runTest.ts +++ b/Extension/test/integrationTests/languageServer/runTest.ts @@ -12,7 +12,7 @@ async function main() { // Passed to --extensionTestsPath const extensionTestsPath = path.resolve(__dirname, './index'); - const testWorkspace = path.resolve(extensionDevelopmentPath, 'test/integrationTests/testAssets/SimpleCppProject'); + const testWorkspace = path.resolve(extensionDevelopmentPath, 'test/integrationTests/testAssets/SimpleCppProject/simpleCppProject.code-workspace'); const launchArgs = [ "--disable-extensions", testWorkspace ]; diff --git a/Extension/test/integrationTests/testAssets/SimpleCppProject/simpleCppProject.code-workspace b/Extension/test/integrationTests/testAssets/SimpleCppProject/simpleCppProject.code-workspace new file mode 100644 index 0000000000..be78eb6c3a --- /dev/null +++ b/Extension/test/integrationTests/testAssets/SimpleCppProject/simpleCppProject.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../nonExistent" + } + ] +} \ No newline at end of file