Skip to content

Commit 5f3a610

Browse files
committed
mroe
1 parent 36b8ab8 commit 5f3a610

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

src/csharpExtensionExports.ts

+2
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ export interface CSharpExtensionExperimentalExports {
3535
token: vscode.CancellationToken
3636
) => Promise<Response>;
3737
languageServerEvents: LanguageServerEvents;
38+
outputChannel: vscode.OutputChannel;
39+
traceChannel: vscode.OutputChannel;
3840
}

src/lsptoolshost/roslynLanguageServer.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1039,15 +1039,14 @@ export async function activateRoslynLanguageServer(
10391039
platformInfo: PlatformInformation,
10401040
optionObservable: Observable<void>,
10411041
outputChannel: vscode.OutputChannel,
1042+
traceChannel: vscode.OutputChannel,
10421043
dotnetTestChannel: vscode.OutputChannel,
10431044
dotnetChannel: vscode.OutputChannel,
10441045
reporter: TelemetryReporter,
10451046
languageServerEvents: RoslynLanguageServerEvents
10461047
): Promise<RoslynLanguageServer> {
1047-
// Create a channel for outputting general logs from the language server.
10481048
_channel = outputChannel;
1049-
// Create a separate channel for outputting trace logs - these are incredibly verbose and make other logs very difficult to see.
1050-
_traceChannel = vscode.window.createOutputChannel('C# LSP Trace Logs');
1049+
_traceChannel = traceChannel;
10511050

10521051
const hostExecutableResolver = new DotnetRuntimeExtensionResolver(
10531052
platformInfo,

src/main.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export async function activate(
106106
let roslynLanguageServerStartedPromise: Promise<RoslynLanguageServer> | undefined = undefined;
107107
let razorLanguageServerStartedPromise: Promise<void> | undefined = undefined;
108108
let projectInitializationCompletePromise: Promise<void> | undefined = undefined;
109-
109+
const traceChannel = vscode.window.createOutputChannel('C# LSP Trace Logs');
110110
if (!useOmnisharpServer) {
111111
// Activate Razor. Needs to be activated before Roslyn so commands are registered in the correct order.
112112
// Otherwise, if Roslyn starts up first, they could execute commands that don't yet exist on Razor's end.
@@ -141,6 +141,7 @@ export async function activate(
141141
platformInfo,
142142
optionStream,
143143
csharpChannel,
144+
traceChannel,
144145
dotnetTestChannel,
145146
dotnetChannel,
146147
reporter,
@@ -246,6 +247,8 @@ export async function activate(
246247
experimental: {
247248
sendServerRequest: async (t, p, ct) => await languageServerExport.sendRequest(t, p, ct),
248249
languageServerEvents: roslynLanguageServerEvents,
250+
outputChannel: csharpChannel,
251+
traceChannel: traceChannel,
249252
},
250253
getComponentFolder: (componentName) => {
251254
return getComponentFolder(componentName, languageServerOptions);

test/lsptoolshost/integrationTests/codeactions.integration.test.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import {
1313
expectText,
1414
openFileInWorkspaceAsync,
1515
} from './integrationHelpers';
16+
import { CSharpExtensionExports } from '../../../src/csharpExtensionExports';
1617

1718
describe(`Code Actions Tests`, () => {
19+
let csharpExports: CSharpExtensionExports | undefined = undefined;
1820
beforeAll(async () => {
19-
await activateCSharpExtension();
21+
csharpExports = await activateCSharpExtension();
2022
});
2123

2224
beforeEach(async () => {
@@ -34,7 +36,11 @@ describe(`Code Actions Tests`, () => {
3436

3537
test('Lightbulb displays actions', async () => {
3638
console.log('LIGHTBULB TEST');
39+
csharpExports!.experimental.outputChannel.appendLine('Lightbulb displays actions');
40+
csharpExports!.experimental.traceChannel.appendLine('Lightbulb displays actions');
3741
const actions = await getCodeActions(new vscode.Range(0, 0, 0, 12));
42+
csharpExports!.experimental.traceChannel.appendLine(`Got actions ${actions.length}`);
43+
csharpExports!.experimental.traceChannel.appendLine(JSON.stringify(actions, null, 4));
3844
expect(actions.length).toBeGreaterThanOrEqual(3);
3945
console.log(actions.length);
4046
console.log(actions.map((a) => a.title).join(', '));
@@ -314,22 +320,18 @@ async function getCodeActions(
314320
range: vscode.Range,
315321
resolveCount: number | undefined = undefined
316322
): Promise<vscode.CodeAction[]> {
323+
const uri = vscode.window.activeTextEditor!.document.uri;
324+
console.log(`Getting actions for ${uri.toString()}`);
317325
const codeActions = await vscode.commands.executeCommand<vscode.CodeAction[]>(
318326
'vscode.executeCodeActionProvider',
319-
vscode.window.activeTextEditor!.document.uri,
327+
uri,
320328
range,
321329
/** kind **/ undefined,
322330
resolveCount
323331
);
324332

325333
console.log(JSON.stringify(codeActions, null, 4));
326334

327-
const moreAction = codeActions.find((a) => a.title === 'More...');
328-
if (moreAction) {
329-
console.log('More actions available');
330-
console.log(JSON.stringify(moreAction, null, 4));
331-
}
332-
333335
return codeActions;
334336
}
335337

test/lsptoolshost/integrationTests/integrationHelpers.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import testAssetWorkspace from './testAssets/testAssetWorkspace';
1313
import { EOL } from 'os';
1414
import { describe, expect, test } from '@jest/globals';
1515

16-
export async function activateCSharpExtension(): Promise<void> {
16+
export async function activateCSharpExtension(): Promise<CSharpExtensionExports> {
1717
const csharpExtension = vscode.extensions.getExtension<CSharpExtensionExports>('ms-dotnettools.csharp');
1818
if (!csharpExtension) {
1919
throw new Error('Failed to find installation of ms-dotnettools.csharp');
@@ -53,6 +53,8 @@ export async function activateCSharpExtension(): Promise<void> {
5353
if (shouldRestart) {
5454
await restartLanguageServer();
5555
}
56+
57+
return csharpExtension.exports;
5658
}
5759

5860
export function usingDevKit(): boolean {

test/vscodeLauncher.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function prepareVSCodeAndExecuteTests(
1515
userDataDir: string,
1616
env: NodeJS.ProcessEnv
1717
): Promise<number> {
18-
const vscodeExecutablePath = await downloadAndUnzipVSCode('1.94.2');
18+
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable');
1919
const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
2020

2121
console.log('Display: ' + env.DISPLAY);

0 commit comments

Comments
 (0)