From 8793dcd796698f58a273d9b23b170180dcdbf3dd Mon Sep 17 00:00:00 2001 From: David Barbet Date: Thu, 19 Jun 2025 15:03:32 -0700 Subject: [PATCH] Address profiling review feedback --- package.json | 4 ++-- package.nls.json | 2 +- src/lsptoolshost/profiling/profiling.ts | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index ba18c8c8c..3a9815391 100644 --- a/package.json +++ b/package.json @@ -1899,8 +1899,8 @@ "enablement": "dotnet.server.activationContext == 'OmniSharp'" }, { - "command": "csharp.recordTrace", - "title": "%command.csharp.recordTrace%", + "command": "csharp.recordLanguageServerTrace", + "title": "%command.csharp.recordLanguageServerTrace%", "category": "CSharp", "enablement": "dotnet.server.activationContext == 'Roslyn' || dotnet.server.activationContext == 'RoslynDevKit'" }, diff --git a/package.nls.json b/package.nls.json index 19983916d..13a2035c2 100644 --- a/package.nls.json +++ b/package.nls.json @@ -17,7 +17,7 @@ "command.csharp.attachToProcess": "Attach to a .NET 5+ or .NET Core process", "command.csharp.reportIssue": "Report an issue", "command.csharp.showDecompilationTerms": "Show the decompiler terms agreement", - "command.csharp.recordTrace": "Record a performance trace of the C# Language Server", + "command.csharp.recordLanguageServerTrace": "Record a performance trace of the C# Language Server", "command.extension.showRazorCSharpWindow": "Show Razor CSharp", "command.extension.showRazorHtmlWindow": "Show Razor Html", "command.razor.reportIssue": "Report a Razor issue", diff --git a/src/lsptoolshost/profiling/profiling.ts b/src/lsptoolshost/profiling/profiling.ts index 7d45b0e89..264acb8fc 100644 --- a/src/lsptoolshost/profiling/profiling.ts +++ b/src/lsptoolshost/profiling/profiling.ts @@ -37,7 +37,7 @@ export function registerTraceCommand( outputChannel: vscode.LogOutputChannel ): void { context.subscriptions.push( - vscode.commands.registerCommand('csharp.recordTrace', async () => { + vscode.commands.registerCommand('csharp.recordLanguageServerTrace', async () => { await vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, @@ -86,9 +86,9 @@ async function executeDotNetTraceCommand( throw new Error(vscode.l10n.t('Language server process not found, ensure the server is running.')); } - let traceFolder: string | undefined = ''; + let traceFolderUri: vscode.Uri | undefined; if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders?.length >= 1) { - traceFolder = vscode.workspace.workspaceFolders[0].uri.fsPath; + traceFolderUri = vscode.workspace.workspaceFolders[0].uri; } // Prompt the user for the folder to save the trace file @@ -97,7 +97,7 @@ async function executeDotNetTraceCommand( canSelectFiles: false, canSelectFolders: true, canSelectMany: false, - defaultUri: traceFolder ? vscode.Uri.file(traceFolder) : undefined, + defaultUri: traceFolderUri ? traceFolderUri : undefined, openLabel: vscode.l10n.t('Select Trace Folder'), title: vscode.l10n.t('Select Folder to Save Trace File'), }); @@ -107,7 +107,7 @@ async function executeDotNetTraceCommand( return; } - traceFolder = uris[0].fsPath; + const traceFolder = uris[0].fsPath; if (!fs.existsSync(traceFolder)) { throw new Error(vscode.l10n.t(`Folder for trace file {0} does not exist`, traceFolder)); @@ -129,14 +129,14 @@ async function executeDotNetTraceCommand( return; } - const terminal = await getOrCreateTerminal(traceFolder, outputChannel); - const dotnetTraceInstalled = await verifyOrAcquireDotnetTrace(traceFolder, progress, outputChannel); if (!dotnetTraceInstalled) { // Cancelled or unable to install dotnet-trace return; } + const terminal = await getOrCreateTerminal(traceFolder, outputChannel); + const args = ['collect', ...userArgs.split(' ')]; progress.report({ message: vscode.l10n.t('Recording trace...') });