Skip to content

Commit 25c07c1

Browse files
authored
Improve the limited activation experience (#8564)
2 parents a11b972 + 89fc0bd commit 25c07c1

File tree

6 files changed

+44
-8
lines changed

6 files changed

+44
-8
lines changed

l10n/bundle.l10n.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
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?",
2+
"Reload Extensions": "Reload Extensions",
3+
"Workspace trust has changed. Would you like to reload extensions?": "Workspace trust has changed. Would you like to reload extensions?",
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}.",
@@ -23,6 +23,10 @@
2323
"Transport attach could not obtain processes list.": "Transport attach could not obtain processes list.",
2424
"Error Message: ": "Error Message: ",
2525
"See {0} output": "See {0} output",
26+
"Manage": "Manage",
27+
"C# Activation Status": "C# Activation Status",
28+
"Limited Activation": "Limited Activation",
29+
"The workspace is not trusted.": "The workspace is not trusted.",
2630
"'{0}' was not set in the debug configuration.": "'{0}' was not set in the debug configuration.",
2731
"'{0}' request is not supported for the '{1}' configuration.": "'{0}' request is not supported for the '{1}' configuration.",
2832
"'{0}' was not provided in the debug configuration.": "'{0}' was not provided in the debug configuration.",
@@ -179,6 +183,7 @@
179183
"Choose": "Choose",
180184
"Choose and set default": "Choose and set default",
181185
"Do not load any": "Do not load any",
186+
"Reload C# Extension": "Reload C# Extension",
182187
"Detected change in telemetry settings. These will not take effect until the language server is restarted, would you like to restart?": "Detected change in telemetry settings. These will not take effect until the language server is restarted, would you like to restart?",
183188
"IntelliCode features will not be available, {0} failed to activate.": "IntelliCode features will not be available, {0} failed to activate.",
184189
"Go to output": "Go to output",

src/lsptoolshost/projectContext/projectContextStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { RoslynLanguageServer } from '../server/roslynLanguageServer';
88
import { languageServerOptions } from '../../shared/options';
99
import { RazorLanguage } from '../../razor/src/razorLanguage';
1010
import { ServerState } from '../server/languageServerEvents';
11-
import { combineDocumentSelectors } from '../utils/combineDocumentSelectors';
11+
import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors';
1212

1313
export class ProjectContextStatus {
1414
static createStatusItem(context: vscode.ExtensionContext, languageServer: RoslynLanguageServer) {

src/lsptoolshost/workspace/workspaceStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as vscode from 'vscode';
77
import { RoslynLanguageServerEvents, ServerState } from '../server/languageServerEvents';
8-
import { combineDocumentSelectors } from '../utils/combineDocumentSelectors';
8+
import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors';
99
import { languageServerOptions } from '../../shared/options';
1010

1111
export class WorkspaceStatus {

src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { checkIsSupportedPlatform } from './checkSupportedPlatform';
3030
import { activateOmniSharp } from './activateOmniSharp';
3131
import { activateRoslyn } from './activateRoslyn';
3232
import { CommandOption, showInformationMessage } from './shared/observers/utils/showMessage';
33+
import { LimitedActivationStatus } from './shared/limitedActivationStatus';
3334

3435
export async function activate(
3536
context: vscode.ExtensionContext
@@ -104,15 +105,14 @@ export async function activate(
104105
await vscode.commands.executeCommand('setContext', 'dotnet.server.activationContext', 'Limited');
105106
exports = { isLimitedActivation: true };
106107
csharpChannel.info('C# Extension activated in limited mode due to workspace trust not being granted.');
108+
LimitedActivationStatus.createStatusItem(context);
107109
context.subscriptions.push(
108110
vscode.workspace.onDidGrantWorkspaceTrust(() => {
109111
const reloadTitle: CommandOption = {
110-
title: vscode.l10n.t('Reload C# Extension'),
112+
title: vscode.l10n.t('Reload Extensions'),
111113
command: 'workbench.action.restartExtensionHost',
112114
};
113-
const message = vscode.l10n.t(
114-
'Workspace trust has changed. Would you like to reload the C# extension?'
115-
);
115+
const message = vscode.l10n.t('Workspace trust has changed. Would you like to reload extensions?');
116116
showInformationMessage(vscode, message, reloadTitle);
117117
})
118118
);

src/shared/limitedActivationStatus.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as vscode from 'vscode';
7+
import { languageServerOptions } from './options';
8+
import { RazorLanguage } from '../razor/src/razorLanguage';
9+
import { combineDocumentSelectors } from './utils/combineDocumentSelectors';
10+
11+
export class LimitedActivationStatus {
12+
static createStatusItem(context: vscode.ExtensionContext) {
13+
const documentSelector = combineDocumentSelectors(
14+
languageServerOptions.documentSelector,
15+
RazorLanguage.documentSelector
16+
);
17+
18+
const manageWorkspaceTrust = {
19+
command: 'workbench.trust.manage',
20+
title: vscode.l10n.t('Manage'),
21+
};
22+
23+
const item = vscode.languages.createLanguageStatusItem('csharp.limitedActivationStatus', documentSelector);
24+
item.name = vscode.l10n.t('C# Activation Status');
25+
item.text = vscode.l10n.t('Limited Activation');
26+
item.detail = vscode.l10n.t('The workspace is not trusted.');
27+
item.command = manageWorkspaceTrust;
28+
item.severity = vscode.LanguageStatusSeverity.Error;
29+
context.subscriptions.push(item);
30+
}
31+
}

0 commit comments

Comments
 (0)