Skip to content

Commit 7d5f0d7

Browse files
committed
Change log level and restart ext host
1 parent f699da8 commit 7d5f0d7

File tree

2 files changed

+48
-44
lines changed

2 files changed

+48
-44
lines changed

l10n/bundle.l10n.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"Reload Window": "Reload Window",
3-
"Workspace trust has changed. Would you like to reload the window to activate the C# extension?": "Workspace trust has changed. Would you like to reload the window to activate the C# extension?",
2+
"Reload C# Extension": "Reload C# Extension",
3+
"Workspace trust has changed. Would you like to reload the C# extension?": "Workspace trust has changed. Would you like to reload the C# extension?",
44
"How to setup Remote Debugging": "How to setup Remote Debugging",
55
"The C# extension for Visual Studio Code is incompatible on {0} {1} with the VS Code Remote Extensions. To see avaliable workarounds, click on '{2}'.": "The C# extension for Visual Studio Code is incompatible on {0} {1} with the VS Code Remote Extensions. To see avaliable workarounds, click on '{2}'.",
66
"The C# extension for Visual Studio Code is incompatible on {0} {1}.": "The C# extension for Visual Studio Code is incompatible on {0} {1}.",
@@ -148,6 +148,7 @@
148148
"OmniSharp requires a complete install of Mono (including MSBuild) to provide language services when `omnisharp.useModernNet` is disabled in Settings. Please install the latest Mono and restart.": "OmniSharp requires a complete install of Mono (including MSBuild) to provide language services when `omnisharp.useModernNet` is disabled in Settings. Please install the latest Mono and restart.",
149149
"Download Mono": "Download Mono",
150150
"Open settings": "Open settings",
151+
"Reload Window": "Reload Window",
151152
"dotnet.server.useOmnisharp option has changed. Please reload the window to apply the change": "dotnet.server.useOmnisharp option has changed. Please reload the window to apply the change",
152153
"C# configuration has changed. Would you like to relaunch the Language Server with your changes?": "C# configuration has changed. Would you like to relaunch the Language Server with your changes?",
153154
"Restart Language Server": "Restart Language Server",

src/main.ts

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -97,63 +97,66 @@ export async function activate(
9797
requiredPackageIds
9898
);
9999

100-
const getCoreClrDebugPromise = async (languageServerStartedPromise: Promise<void>) => {
101-
let coreClrDebugPromise = Promise.resolve();
102-
if (runtimeDependenciesExist) {
103-
// activate coreclr-debug
104-
coreClrDebugPromise = coreclrdebug.activate(
105-
context.extension,
106-
context,
107-
platformInfo,
108-
eventStream,
109-
csharpChannel,
110-
languageServerStartedPromise
111-
);
112-
}
113-
114-
return coreClrDebugPromise;
115-
};
116-
117100
let activationEvent = TelemetryEventNames.CSharpActivated;
118101
let exports: CSharpExtensionExports | OmnisharpExtensionExports | LimitedExtensionExports;
119102
if (vscode.workspace.isTrusted !== true) {
120103
activationEvent = TelemetryEventNames.CSharpLimitedActivation;
104+
await vscode.commands.executeCommand('setContext', 'dotnet.server.activationContext', 'Limited');
121105
exports = { isLimitedActivation: true };
122-
csharpChannel.trace('C# Extension activated in limited mode due to workspace trust not being granted.');
106+
csharpChannel.info('C# Extension activated in limited mode due to workspace trust not being granted.');
123107
context.subscriptions.push(
124108
vscode.workspace.onDidGrantWorkspaceTrust(() => {
125109
const reloadTitle: CommandOption = {
126-
title: vscode.l10n.t('Reload Window'),
127-
command: 'workbench.action.reloadWindow',
110+
title: vscode.l10n.t('Reload C# Extension'),
111+
command: 'workbench.action.restartExtensionHost',
128112
};
129113
const message = vscode.l10n.t(
130-
'Workspace trust has changed. Would you like to reload the window to activate the C# extension?'
114+
'Workspace trust has changed. Would you like to reload the C# extension?'
131115
);
132116
showInformationMessage(vscode, message, reloadTitle);
133117
})
134118
);
135-
} else if (!useOmnisharpServer) {
136-
exports = activateRoslyn(
137-
context,
138-
platformInfo,
139-
optionStream,
140-
eventStream,
141-
csharpChannel,
142-
reporter,
143-
csharpDevkitExtension,
144-
getCoreClrDebugPromise
145-
);
146119
} else {
147-
exports = activateOmniSharp(
148-
context,
149-
platformInfo,
150-
optionStream,
151-
networkSettingsProvider,
152-
eventStream,
153-
csharpChannel,
154-
reporter,
155-
getCoreClrDebugPromise
156-
);
120+
const getCoreClrDebugPromise = async (languageServerStartedPromise: Promise<void>) => {
121+
let coreClrDebugPromise = Promise.resolve();
122+
if (runtimeDependenciesExist) {
123+
// activate coreclr-debug
124+
coreClrDebugPromise = coreclrdebug.activate(
125+
context.extension,
126+
context,
127+
platformInfo,
128+
eventStream,
129+
csharpChannel,
130+
languageServerStartedPromise
131+
);
132+
}
133+
134+
return coreClrDebugPromise;
135+
};
136+
137+
if (!useOmnisharpServer) {
138+
exports = activateRoslyn(
139+
context,
140+
platformInfo,
141+
optionStream,
142+
eventStream,
143+
csharpChannel,
144+
reporter,
145+
csharpDevkitExtension,
146+
getCoreClrDebugPromise
147+
);
148+
} else {
149+
exports = activateOmniSharp(
150+
context,
151+
platformInfo,
152+
optionStream,
153+
networkSettingsProvider,
154+
eventStream,
155+
csharpChannel,
156+
reporter,
157+
getCoreClrDebugPromise
158+
);
159+
}
157160
}
158161

159162
const timeTaken = process.hrtime(startActivation);

0 commit comments

Comments
 (0)