Skip to content

Address profiling review feedback #8374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
},
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions src/lsptoolshost/profiling/profiling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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'),
});
Expand All @@ -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));
Expand All @@ -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...') });
Expand Down
Loading