Skip to content

Commit 55cb7bf

Browse files
committed
mroe
1 parent 88cfba9 commit 55cb7bf

File tree

6 files changed

+22
-15
lines changed

6 files changed

+22
-15
lines changed

src/csharpExtensionExports.ts

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,14 +1063,12 @@ export async function activateRoslynLanguageServer(
10631063
platformInfo: PlatformInformation,
10641064
optionObservable: Observable<void>,
10651065
outputChannel: vscode.LogOutputChannel,
1066+
traceChannel: vscode.OutputChannel,
10661067
reporter: TelemetryReporter,
10671068
languageServerEvents: RoslynLanguageServerEvents
10681069
): Promise<RoslynLanguageServer> {
1069-
// Create a channel for outputting general logs from the language server.
10701070
_channel = outputChannel;
1071-
// Create a separate channel for outputting trace logs - these are incredibly verbose and make other logs very difficult to see.
1072-
// The trace channel verbosity is controlled by the _channel verbosity.
1073-
_traceChannel = vscode.window.createOutputChannel('C# LSP Trace Logs');
1071+
_traceChannel = traceChannel;
10741072

10751073
const hostExecutableResolver = new DotnetRuntimeExtensionResolver(
10761074
platformInfo,

src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export async function activate(
104104
let roslynLanguageServerStartedPromise: Promise<RoslynLanguageServer> | undefined = undefined;
105105
let razorLanguageServerStartedPromise: Promise<void> | undefined = undefined;
106106
let projectInitializationCompletePromise: Promise<void> | undefined = undefined;
107-
107+
const traceChannel = vscode.window.createOutputChannel('C# LSP Trace Logs');
108108
if (!useOmnisharpServer) {
109109
// Activate Razor. Needs to be activated before Roslyn so commands are registered in the correct order.
110110
// Otherwise, if Roslyn starts up first, they could execute commands that don't yet exist on Razor's end.
@@ -139,6 +139,7 @@ export async function activate(
139139
platformInfo,
140140
optionStream,
141141
csharpChannel,
142+
traceChannel,
142143
reporter,
143144
roslynLanguageServerEvents
144145
);
@@ -244,6 +245,8 @@ export async function activate(
244245
experimental: {
245246
sendServerRequest: async (t, p, ct) => await languageServerExport.sendRequest(t, p, ct),
246247
languageServerEvents: roslynLanguageServerEvents,
248+
outputChannel: csharpChannel,
249+
traceChannel: traceChannel,
247250
},
248251
getComponentFolder: (componentName) => {
249252
return getComponentFolder(componentName, languageServerOptions);

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

Lines changed: 10 additions & 8 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)