Skip to content

Commit c0c1ac6

Browse files
CR: Enable Razor features by default; define 'razor.disabled' config option to turn them off
1 parent 8ca1228 commit c0c1ac6

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@
655655
"default": false,
656656
"description": "Specifies whether notifications should be shown if OmniSharp encounters warnings or errors loading a project. Note that these warnings/errors are always emitted to the OmniSharp log"
657657
},
658-
"omnisharp.preview": {
658+
"razor.disabled": {
659659
"type": "boolean",
660660
"default": false,
661-
"description": "Specifies whether to enable OmniSharp preview features."
661+
"description": "Specifies whether to disable Razor language features."
662662
},
663663
"razor.languageServer.directory": {
664664
"type": [

src/main.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
135135
coreClrDebugPromise = coreclrdebug.activate(extension, context, platformInfo, eventStream);
136136
}
137137

138-
if (optionProvider.GetLatestOptions().preview) {
139-
await activateRazorExtension(context, eventStream);
140-
}
138+
await activateRazorExtension(context, eventStream);
141139

142140
return {
143141
initializationFinished: async () => {

src/omnisharp/options.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export class Options {
2323
public minFindSymbolsFilterLength: number,
2424
public maxFindSymbolsItems: number,
2525
public defaultLaunchSolution?: string,
26-
public monoPath?: string,
27-
public preview?: boolean) { }
26+
public monoPath?: string) { }
2827

2928

3029
public static Read(vscode: vscode): Options {
@@ -69,8 +68,6 @@ export class Options {
6968
const minFindSymbolsFilterLength = omnisharpConfig.get<number>('minFindSymbolsFilterLength', 0);
7069
const maxFindSymbolsItems = omnisharpConfig.get<number>('maxFindSymbolsItems', 1000); // The limit is applied only when this setting is set to a number greater than zero
7170

72-
const preview = omnisharpConfig.get<boolean>('preview', false);
73-
7471
return new Options(
7572
path,
7673
useGlobalMono,
@@ -89,7 +86,6 @@ export class Options {
8986
maxFindSymbolsItems,
9087
defaultLaunchSolution,
9188
monoPath,
92-
preview,
9389
);
9490
}
9591

src/razor/razor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import * as Razor from 'microsoft.aspnetcore.razor.vscode';
1010
import { EventStream } from '../EventStream';
1111

1212
export async function activateRazorExtension(context: vscode.ExtensionContext, eventStream: EventStream) {
13+
// Bail out as early as possible if Razor language features are disabled
1314
const razorConfig = vscode.workspace.getConfiguration('razor');
15+
const razorDisabled = razorConfig.get<boolean>('disabled', false);
16+
if (razorDisabled) {
17+
return;
18+
}
19+
1420
const configuredLanguageServerDir = razorConfig.get<string>('languageServer.directory', null);
1521
const languageServerDir = configuredLanguageServerDir || path.join(context.extensionPath, '.razor');
1622

0 commit comments

Comments
 (0)