Skip to content

Commit 5f95b3c

Browse files
authored
Address profiling review feedback (#8374)
2 parents 42262fe + ce90ccd commit 5f95b3c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

SUPPORT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ If the language server crashes, general logs are often helpful for diagnosing th
120120

121121
When investigating performance issues, we may request a performance trace of the language server to diagnose what is causing the problem. These are typically taken via [dotnet-trace](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace) (a cross platform tool to collect performance traces of .NET processes)
122122

123-
The C# extension has a built in command, `csharp.recordTrace` to help with trace collection. This command will install `dotnet-trace` as a global tool and invoke it against the language server.
123+
The C# extension has a built in command, `csharp.recordLanguageServerTrace` to help with trace collection. This command will install `dotnet-trace` as a global tool and invoke it against the language server.
124124

125-
1. Invoke the `csharp.recordTrace` command
125+
1. Invoke the record language server trace command
126126
![alt text](docs/recordTraceCommand.png)
127127
2. Select the folder to save the trace.
128128
3. Accept the default trace arguments, or change them if requested

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,8 +1889,8 @@
18891889
"enablement": "dotnet.server.activationContext == 'OmniSharp'"
18901890
},
18911891
{
1892-
"command": "csharp.recordTrace",
1893-
"title": "%command.csharp.recordTrace%",
1892+
"command": "csharp.recordLanguageServerTrace",
1893+
"title": "%command.csharp.recordLanguageServerTrace%",
18941894
"category": "CSharp",
18951895
"enablement": "dotnet.server.activationContext == 'Roslyn' || dotnet.server.activationContext == 'RoslynDevKit'"
18961896
},

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"command.csharp.attachToProcess": "Attach to a .NET 5+ or .NET Core process",
1818
"command.csharp.reportIssue": "Report an issue",
1919
"command.csharp.showDecompilationTerms": "Show the decompiler terms agreement",
20-
"command.csharp.recordTrace": "Record a performance trace of the C# Language Server",
20+
"command.csharp.recordLanguageServerTrace": "Record a performance trace of the C# Language Server",
2121
"command.extension.showRazorCSharpWindow": "Show Razor CSharp",
2222
"command.extension.showRazorHtmlWindow": "Show Razor Html",
2323
"command.razor.reportIssue": "Report a Razor issue",

src/lsptoolshost/profiling/profiling.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function registerTraceCommand(
3737
outputChannel: vscode.LogOutputChannel
3838
): void {
3939
context.subscriptions.push(
40-
vscode.commands.registerCommand('csharp.recordTrace', async () => {
40+
vscode.commands.registerCommand('csharp.recordLanguageServerTrace', async () => {
4141
await vscode.window.withProgress(
4242
{
4343
location: vscode.ProgressLocation.Notification,
@@ -86,9 +86,9 @@ async function executeDotNetTraceCommand(
8686
throw new Error(vscode.l10n.t('Language server process not found, ensure the server is running.'));
8787
}
8888

89-
let traceFolder: string | undefined = '';
89+
let traceFolderUri: vscode.Uri | undefined;
9090
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders?.length >= 1) {
91-
traceFolder = vscode.workspace.workspaceFolders[0].uri.fsPath;
91+
traceFolderUri = vscode.workspace.workspaceFolders[0].uri;
9292
}
9393

9494
// Prompt the user for the folder to save the trace file
@@ -97,7 +97,7 @@ async function executeDotNetTraceCommand(
9797
canSelectFiles: false,
9898
canSelectFolders: true,
9999
canSelectMany: false,
100-
defaultUri: traceFolder ? vscode.Uri.file(traceFolder) : undefined,
100+
defaultUri: traceFolderUri ? traceFolderUri : undefined,
101101
openLabel: vscode.l10n.t('Select Trace Folder'),
102102
title: vscode.l10n.t('Select Folder to Save Trace File'),
103103
});
@@ -107,7 +107,7 @@ async function executeDotNetTraceCommand(
107107
return;
108108
}
109109

110-
traceFolder = uris[0].fsPath;
110+
const traceFolder = uris[0].fsPath;
111111

112112
if (!fs.existsSync(traceFolder)) {
113113
throw new Error(vscode.l10n.t(`Folder for trace file {0} does not exist`, traceFolder));
@@ -129,14 +129,14 @@ async function executeDotNetTraceCommand(
129129
return;
130130
}
131131

132-
const terminal = await getOrCreateTerminal(traceFolder, outputChannel);
133-
134132
const dotnetTraceInstalled = await verifyOrAcquireDotnetTrace(traceFolder, progress, outputChannel);
135133
if (!dotnetTraceInstalled) {
136134
// Cancelled or unable to install dotnet-trace
137135
return;
138136
}
139137

138+
const terminal = await getOrCreateTerminal(traceFolder, outputChannel);
139+
140140
const args = ['collect', ...userArgs.split(' ')];
141141

142142
progress.report({ message: vscode.l10n.t('Recording trace...') });

0 commit comments

Comments
 (0)