-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix command enablement by using specific activation contexts for O#, …
…Roslyn standalone, and Roslyn devkit
- Loading branch information
Showing
5 changed files
with
123 additions
and
20 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
omnisharptest/omnisharpIntegrationTests/omnisharpCommands.integration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { expect, test, beforeAll, afterAll, describe } from '@jest/globals'; | ||
import * as vscode from 'vscode'; | ||
import { activateCSharpExtension } from './integrationHelpers'; | ||
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; | ||
|
||
describe(`Command Enablement: ${testAssetWorkspace.description}`, function () { | ||
beforeAll(async function () { | ||
const activation = await activateCSharpExtension(); | ||
await testAssetWorkspace.restore(); | ||
await testAssetWorkspace.waitForIdle(activation.eventStream); | ||
}); | ||
|
||
afterAll(async () => { | ||
await testAssetWorkspace.cleanupWorkspace(); | ||
}); | ||
|
||
test('Only expected commands are available', async function () { | ||
const commands = await vscode.commands.getCommands(true); | ||
|
||
// Ensure the O# commands are available. | ||
expect(commands).toContain('o.restart'); | ||
expect(commands).toContain('o.pickProjectAndStart'); | ||
expect(commands).toContain('o.fixAll.solution'); | ||
expect(commands).toContain('o.fixAll.project'); | ||
expect(commands).toContain('o.fixAll.document'); | ||
expect(commands).toContain('o.reanalyze.allProjects'); | ||
expect(commands).toContain('o.reanalyze.currentProject'); | ||
expect(commands).toContain('dotnet.generateAssets'); | ||
expect(commands).toContain('dotnet.restore.project'); | ||
expect(commands).toContain('dotnet.restore.all'); | ||
expect(commands).toContain('dotnet.test.runTestsInContext'); | ||
expect(commands).toContain('dotnet.test.debugTestsInContext'); | ||
expect(commands).toContain('csharp.listProcess'); | ||
expect(commands).toContain('csharp.listRemoteProcess'); | ||
expect(commands).toContain('csharp.listRemoteDockerProcess'); | ||
expect(commands).toContain('csharp.attachToProcess'); | ||
expect(commands).toContain('csharp.reportIssue'); | ||
expect(commands).toContain('csharp.showDecompilationTerms'); | ||
|
||
// Ensure the non-O# commands are not available. | ||
expect(commands).not.toContain('dotnet.openSolution'); | ||
expect(commands).not.toContain('dotnet.restartServer'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
test/integrationTests/commandEnablement.integration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { expect, test, beforeAll, afterAll, describe } from '@jest/globals'; | ||
import * as vscode from 'vscode'; | ||
import { activateCSharpExtension } from './integrationHelpers'; | ||
import testAssetWorkspace from './testAssets/testAssetWorkspace'; | ||
|
||
describe(`Command Enablement: ${testAssetWorkspace.description}`, function () { | ||
beforeAll(async function () { | ||
await activateCSharpExtension(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await testAssetWorkspace.cleanupWorkspace(); | ||
}); | ||
|
||
test('Only expected commands are available', async function () { | ||
const commands = await vscode.commands.getCommands(true); | ||
|
||
// Ensure the standalone Roslyn commands are available. | ||
expect(commands).toContain('dotnet.openSolution'); | ||
expect(commands).toContain('dotnet.restartServer'); | ||
expect(commands).toContain('dotnet.generateAssets'); | ||
expect(commands).toContain('dotnet.restore.project'); | ||
expect(commands).toContain('dotnet.restore.all'); | ||
expect(commands).toContain('dotnet.test.runTestsInContext'); | ||
expect(commands).toContain('dotnet.test.debugTestsInContext'); | ||
expect(commands).toContain('csharp.listProcess'); | ||
expect(commands).toContain('csharp.listRemoteProcess'); | ||
expect(commands).toContain('csharp.listRemoteDockerProcess'); | ||
expect(commands).toContain('csharp.attachToProcess'); | ||
expect(commands).toContain('csharp.reportIssue'); | ||
|
||
// Ensure the O#-only commands are not available. | ||
expect(commands).not.toContain('o.restart'); | ||
expect(commands).not.toContain('o.pickProjectAndStart'); | ||
expect(commands).not.toContain('o.fixAll.solution'); | ||
expect(commands).not.toContain('o.fixAll.project'); | ||
expect(commands).not.toContain('o.fixAll.document'); | ||
expect(commands).not.toContain('o.reanalyze.allProjects'); | ||
expect(commands).not.toContain('o.reanalyze.currentProject'); | ||
}); | ||
}); |