Skip to content

Commit 72b6208

Browse files
authored
Hard code ForceRuntimeCodeGeneration feature flag in all cases (#12007)
As discussed this morning, we can at least remove this from the UI and ignore any attempts at configuration. VS Code: dotnet/vscode-csharp#8398
2 parents 0a57d82 + ca994cf commit 72b6208

File tree

15 files changed

+8
-204
lines changed

15 files changed

+8
-204
lines changed

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultLanguageServerFeatureOptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ internal class DefaultLanguageServerFeatureOptions : LanguageServerFeatureOption
3535

3636
public override bool UseRazorCohostServer => false;
3737

38-
public override bool ForceRuntimeCodeGeneration => true;
39-
4038
public override bool UseNewFormattingEngine => true;
4139

4240
public override bool SupportsSoftSelectionInCompletion => true;

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ConfigurableLanguageServerFeatureOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ internal class ConfigurableLanguageServerFeatureOptions : LanguageServerFeatureO
2121
private readonly bool? _updateBuffersForClosedDocuments;
2222
private readonly bool? _includeProjectKeyInGeneratedFilePath;
2323
private readonly bool? _useRazorCohostServer;
24-
private readonly bool? _forceRuntimeCodeGeneration;
2524
private readonly bool? _useNewFormattingEngine;
2625
private readonly bool? _doNotInitializeMiscFilesProjectFromWorkspace;
2726

@@ -36,7 +35,6 @@ internal class ConfigurableLanguageServerFeatureOptions : LanguageServerFeatureO
3635
public override bool UpdateBuffersForClosedDocuments => _updateBuffersForClosedDocuments ?? _defaults.UpdateBuffersForClosedDocuments;
3736
public override bool IncludeProjectKeyInGeneratedFilePath => _includeProjectKeyInGeneratedFilePath ?? _defaults.IncludeProjectKeyInGeneratedFilePath;
3837
public override bool UseRazorCohostServer => _useRazorCohostServer ?? _defaults.UseRazorCohostServer;
39-
public override bool ForceRuntimeCodeGeneration => _forceRuntimeCodeGeneration ?? _defaults.ForceRuntimeCodeGeneration;
4038
public override bool UseNewFormattingEngine => _useNewFormattingEngine ?? _defaults.UseNewFormattingEngine;
4139
public override bool SupportsSoftSelectionInCompletion => false;
4240
public override bool UseVsCodeCompletionTriggerCharacters => true;
@@ -67,7 +65,6 @@ public ConfigurableLanguageServerFeatureOptions(string[] args)
6765
TryProcessBoolOption(nameof(UpdateBuffersForClosedDocuments), ref _updateBuffersForClosedDocuments, option, args, i);
6866
TryProcessBoolOption(nameof(IncludeProjectKeyInGeneratedFilePath), ref _includeProjectKeyInGeneratedFilePath, option, args, i);
6967
TryProcessBoolOption(nameof(UseRazorCohostServer), ref _useRazorCohostServer, option, args, i);
70-
TryProcessBoolOption(nameof(ForceRuntimeCodeGeneration), ref _forceRuntimeCodeGeneration, option, args, i);
7168
TryProcessBoolOption(nameof(UseNewFormattingEngine), ref _useNewFormattingEngine, option, args, i);
7269
TryProcessBoolOption(nameof(DoNotInitializeMiscFilesProjectFromWorkspace), ref _doNotInitializeMiscFilesProjectFromWorkspace, option, args, i);
7370
}

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/LanguageServerFeatureOptions.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ internal abstract class LanguageServerFeatureOptions
3333

3434
public abstract bool UseRazorCohostServer { get; }
3535

36-
/// <summary>
37-
/// When enabled, design time code will not be generated. All tooling, except formatting, will be using runtime code generation.
38-
/// </summary>
39-
public abstract bool ForceRuntimeCodeGeneration { get; }
40-
4136
public abstract bool UseNewFormattingEngine { get; }
4237

4338
/// <summary>
@@ -56,4 +51,12 @@ internal abstract class LanguageServerFeatureOptions
5651
/// all Razor files found under the workspace root path.
5752
/// </summary>
5853
public abstract bool DoNotInitializeMiscFilesProjectFromWorkspace { get; }
54+
55+
/// <summary>
56+
/// When enabled, design time code will not be generated. All tooling, except formatting, will be using runtime code generation.
57+
/// </summary>
58+
/// <remarks>
59+
/// This is now always <see langword="true" /> but cannot be removed entirely until the legacy editor is removed.
60+
/// </remarks>
61+
public bool ForceRuntimeCodeGeneration { get; } = true;
5962
}

src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Initialization/RemoteLanguageServerFeatureOptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public void SetOptions(RemoteClientInitializationOptions options)
4646

4747
public override bool UseRazorCohostServer => _options.UseRazorCohostServer;
4848

49-
public override bool ForceRuntimeCodeGeneration => true;
50-
5149
public override bool UseNewFormattingEngine => true;
5250

5351
public override bool SupportsSoftSelectionInCompletion => _options.SupportsSoftSelectionInCompletion;

src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioLanguageServerFeatureOptions.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ internal class VisualStudioLanguageServerFeatureOptions : LanguageServerFeatureO
1717
private readonly Lazy<bool> _includeProjectKeyInGeneratedFilePath;
1818
private readonly Lazy<bool> _usePreciseSemanticTokenRanges;
1919
private readonly Lazy<bool> _useRazorCohostServer;
20-
private readonly Lazy<bool> _forceRuntimeCodeGeneration;
2120
private readonly Lazy<bool> _useNewFormattingEngine;
2221

2322
[ImportingConstructor]
@@ -58,13 +57,6 @@ public VisualStudioLanguageServerFeatureOptions(ILspEditorFeatureDetector lspEdi
5857
return useRazorCohostServer;
5958
});
6059

61-
_forceRuntimeCodeGeneration = new Lazy<bool>(() =>
62-
{
63-
var featureFlags = (IVsFeatureFlags)Package.GetGlobalService(typeof(SVsFeatureFlags));
64-
var forceRuntimeCodeGeneration = featureFlags.IsFeatureEnabled(WellKnownFeatureFlagNames.ForceRuntimeCodeGeneration, defaultValue: true);
65-
return forceRuntimeCodeGeneration;
66-
});
67-
6860
_useNewFormattingEngine = new Lazy<bool>(() =>
6961
{
7062
var featureFlags = (IVsFeatureFlags)Package.GetGlobalService(typeof(SVsFeatureFlags));
@@ -98,9 +90,6 @@ public VisualStudioLanguageServerFeatureOptions(ILspEditorFeatureDetector lspEdi
9890

9991
public override bool UseRazorCohostServer => _useRazorCohostServer.Value;
10092

101-
/// <inheritdoc />
102-
public override bool ForceRuntimeCodeGeneration => _forceRuntimeCodeGeneration.Value;
103-
10493
public override bool UseNewFormattingEngine => _useNewFormattingEngine.Value;
10594

10695
// VS actually needs explicit commit characters so don't avoid them.

src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/WellKnownFeatureFlagNames.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ internal static class WellKnownFeatureFlagNames
1010
public const string UsePreciseSemanticTokenRanges = "Razor.LSP.UsePreciseSemanticTokenRanges";
1111
public const string UseRazorCohostServer = "Razor.LSP.UseRazorCohostServer";
1212
public const string DisableRazorLanguageServer = "Razor.LSP.DisableRazorLanguageServer";
13-
public const string ForceRuntimeCodeGeneration = "Razor.LSP.ForceRuntimeCodeGeneration";
1413
public const string UseRoslynTokenizer = "Razor.LSP.UseRoslynTokenizer";
1514
public const string UseNewFormattingEngine = "Razor.LSP.UseNewFormattingEngine";
1615
}

src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.Custom.pkgdef

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@
6363
"Title"="Use Roslyn Cohost server for Razor (requires restart)"
6464
"PreviewPaneChannels"="*"
6565

66-
[$RootKey$\FeatureFlags\Razor\LSP\ForceRuntimeCodeGeneration]
67-
"Description"="Enable combined design time/runtime code generation for Razor files"
68-
"Value"=dword:00000001
69-
"Title"="Force use of runtime code generation for Razor (requires restart)"
70-
"PreviewPaneChannels"="*"
71-
7266
[$RootKey$\FeatureFlags\Razor\LSP\UseNewFormattingEngine]
7367
"Description"="Enables the new Razor formatting engine, which provides formatting results that more closely match C# formatting."
7468
"Value"=dword:00000001

src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Services/VSCodeLanguageServerFeatureOptions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ internal class VSCodeLanguageServerFeatureOptions(RazorClientServerManagerProvid
2323
{
2424
private bool _useRazorCohostServer = false;
2525
private bool _useNewFormattingEngine = true;
26-
private bool _forceRuntimeCodeGeneration = false;
2726

2827
private readonly RazorClientServerManagerProvider _razorClientServerManagerProvider = razorClientServerManagerProvider;
2928

@@ -46,7 +45,6 @@ internal class VSCodeLanguageServerFeatureOptions(RazorClientServerManagerProvid
4645

4746
// User configurable options
4847
public override bool UseRazorCohostServer => _useRazorCohostServer;
49-
public override bool ForceRuntimeCodeGeneration => _forceRuntimeCodeGeneration;
5048
public override bool UseNewFormattingEngine => _useNewFormattingEngine;
5149

5250
public int Order => WellKnownStartupOrder.LanguageServerFeatureOptions;
@@ -62,7 +60,6 @@ public async Task StartupAsync(VSInternalClientCapabilities clientCapabilities,
6260
// Roslyn's typescript config handler will convert underscores to camelcase, ie 'razor.languageServer.cohostingEnabled'
6361
new ConfigurationItem { Section = "razor.language_server.cohosting_enabled" },
6462
new ConfigurationItem { Section = "razor.language_server.use_new_formatting_engine" },
65-
new ConfigurationItem { Section = "razor.language_server.force_runtime_code_generation" },
6663
]
6764
};
6865
var options = await razorClientLanguageServerManager.SendRequestAsync<ConfigurationParams, JsonArray>(
@@ -72,7 +69,6 @@ public async Task StartupAsync(VSInternalClientCapabilities clientCapabilities,
7269

7370
_useRazorCohostServer = GetBooleanOptionValue(options[0], _useRazorCohostServer);
7471
_useNewFormattingEngine = GetBooleanOptionValue(options[1], _useNewFormattingEngine);
75-
_forceRuntimeCodeGeneration = GetBooleanOptionValue(options[2], _forceRuntimeCodeGeneration);
7672

7773
RazorCohostingOptions.UseRazorCohostServer = _useRazorCohostServer;
7874
}

src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
77

88
internal class TestLanguageServerFeatureOptions(
99
bool includeProjectKeyInGeneratedFilePath = false,
10-
bool forceRuntimeCodeGeneration = false,
1110
bool updateBuffersForClosedDocuments = false,
1211
bool useNewFormattingEngine = false,
1312
bool supportsSoftSelectionInCompletion = true,
@@ -38,8 +37,6 @@ internal class TestLanguageServerFeatureOptions(
3837

3938
public override bool UseRazorCohostServer => false;
4039

41-
public override bool ForceRuntimeCodeGeneration => forceRuntimeCodeGeneration;
42-
4340
public override bool UseNewFormattingEngine => useNewFormattingEngine;
4441

4542
public override bool SupportsSoftSelectionInCompletion => supportsSoftSelectionInCompletion;

src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Fuse/FuseFactAttribute.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)