Skip to content

Commit 4feabb7

Browse files
committed
Use existing profile when F5 launching integration tests
1 parent 3c57a09 commit 4feabb7

File tree

5 files changed

+17
-32
lines changed

5 files changed

+17
-32
lines changed

.vscode/launch.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
"request": "launch",
1818
"runtimeExecutable": "${execPath}",
1919
"args": [
20-
// Create a temp profile that has no extensions / user settings.
21-
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
22-
"--profile-temp",
20+
// Launch VSCode using a specific profile to ensure that user settings are not used.
21+
// This profile must be imported into vscode before running this launch configuration.
22+
// The profile can be found under /test/csharp-standalone-profile.
23+
"--profile csharp-standalone-profile",
2324
"${workspaceRoot}/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/.vscode/lsp_tools_host_slnWithCsproj.code-workspace",
2425
"--extensionDevelopmentPath=${workspaceRoot}",
2526
"--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests"
@@ -40,9 +41,10 @@
4041
"request": "launch",
4142
"runtimeExecutable": "${execPath}",
4243
"args": [
43-
// Create a temp profile that has no extensions / user settings.
44-
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
45-
"--profile-temp",
44+
// Launch VSCode using a specific profile to ensure that user settings are not used.
45+
// This profile must be imported into vscode before running this launch configuration.
46+
// The profile can be found under /test/csharp-standalone-profile.
47+
"--profile csharp-standalone-profile",
4648
"${workspaceRoot}/test/razor/razorIntegrationTests/testAssets/BasicRazorApp2_1/.vscode/lsp_tools_host_BasicRazorApp2_1.code-workspace",
4749
"--extensionDevelopmentPath=${workspaceRoot}",
4850
"--extensionTestsPath=${workspaceRoot}/out/test/razor/razorIntegrationTests"
@@ -63,9 +65,10 @@
6365
"request": "launch",
6466
"runtimeExecutable": "${execPath}",
6567
"args": [
66-
// Create a temp profile that has no extensions / user settings.
67-
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
68-
"--profile-temp",
68+
// Launch VSCode using a specific profile to ensure that user settings are not used.
69+
// This profile must be imported into vscode before running this launch configuration.
70+
// The profile can be found under /test/csharp-standalone-profile.
71+
"--profile csharp-standalone-profile",
6972
"${workspaceRoot}/test/omnisharp/omnisharpIntegrationTests/testAssets/${input:omnisharpAssetName}/.vscode/omnisharp_${input:omnisharpAssetName}.code-workspace",
7073
"--extensionDevelopmentPath=${workspaceRoot}",
7174
"--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests"
@@ -86,9 +89,10 @@
8689
"request": "launch",
8790
"runtimeExecutable": "${execPath}",
8891
"args": [
89-
// Create a temp profile that has no extensions / user settings.
90-
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
91-
"--profile-temp",
92+
// Launch VSCode using a specific profile to ensure that user settings are not used.
93+
// This profile must be imported into vscode before running this launch configuration.
94+
// The profile can be found under /test/csharp-standalone-profile.
95+
"--profile csharp-standalone-profile",
9296
"${workspaceRoot}/test/omnisharp/omnisharpIntegrationTests/testAssets/${input:omnisharpAssetName}/.vscode/omnisharp_lsp_${input:omnisharpAssetName}.code-workspace",
9397
"--extensionDevelopmentPath=${workspaceRoot}",
9498
"--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests"

test/csharp-standalone-profile.code-profile

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

test/lsptoolshost/integrationTests/README.md

Whitespace-only changes.

test/lsptoolshost/integrationTests/integrationHelpers.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ import { ServerState } from '../../../src/lsptoolshost/serverStateChange';
1111
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1212

1313
export async function activateCSharpExtension(): Promise<void> {
14-
// Ensure the dependent extension exists - when launching via F5 launch.json we can't install the extension prior to opening vscode.
15-
const vscodeDotnetRuntimeExtensionId = 'ms-dotnettools.vscode-dotnet-runtime';
16-
const dotnetRuntimeExtension =
17-
vscode.extensions.getExtension<CSharpExtensionExports>(vscodeDotnetRuntimeExtensionId);
18-
if (!dotnetRuntimeExtension) {
19-
await vscode.commands.executeCommand('workbench.extensions.installExtension', vscodeDotnetRuntimeExtensionId, {
20-
donotSync: true,
21-
});
22-
await vscode.commands.executeCommand('workbench.action.reloadWindow');
23-
}
24-
2514
const csharpExtension = vscode.extensions.getExtension<CSharpExtensionExports>('ms-dotnettools.csharp');
2615
if (!csharpExtension) {
2716
throw new Error('Failed to find installation of ms-dotnettools.csharp');

test/omnisharp/omnisharpIntegrationTests/integrationHelpers.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ export interface ActivationResult {
1717
}
1818

1919
export async function activateCSharpExtension(): Promise<ActivationResult> {
20-
// Ensure the dependent extension exists - when launching via F5 launch.json we can't install the extension prior to opening vscode.
21-
const vscodeDotnetRuntimeExtensionId = 'ms-dotnettools.vscode-dotnet-runtime';
22-
const dotnetRuntimeExtension =
23-
vscode.extensions.getExtension<OmnisharpExtensionExports>(vscodeDotnetRuntimeExtensionId);
24-
if (!dotnetRuntimeExtension) {
25-
await vscode.commands.executeCommand('workbench.extensions.installExtension', vscodeDotnetRuntimeExtensionId);
26-
await vscode.commands.executeCommand('workbench.action.reloadWindow');
27-
}
28-
2920
const configuration = vscode.workspace.getConfiguration();
3021
configuration.update(
3122
'omnisharp.enableLspDriver',

0 commit comments

Comments
 (0)