Skip to content

Commit 87f6e7a

Browse files
committed
Add new option to control monitoring the entire workspace
1 parent 3f5e0e8 commit 87f6e7a

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ internal class ConfigurableLanguageServerFeatureOptions : LanguageServerFeatureO
2222
private readonly bool? _usePreciseSemanticTokenRanges;
2323
private readonly bool? _updateBuffersForClosedDocuments;
2424
private readonly bool? _includeProjectKeyInGeneratedFilePath;
25+
private readonly bool? _monitorWorkspaceFolderForConfigurationFiles;
2526

2627
public override bool SupportsFileManipulation => _supportsFileManipulation ?? _defaults.SupportsFileManipulation;
2728
public override string ProjectConfigurationFileName => _projectConfigurationFileName ?? _defaults.ProjectConfigurationFileName;
@@ -35,6 +36,7 @@ internal class ConfigurableLanguageServerFeatureOptions : LanguageServerFeatureO
3536
public override bool UsePreciseSemanticTokenRanges => _usePreciseSemanticTokenRanges ?? _defaults.UsePreciseSemanticTokenRanges;
3637
public override bool UpdateBuffersForClosedDocuments => _updateBuffersForClosedDocuments ?? _defaults.UpdateBuffersForClosedDocuments;
3738
public override bool IncludeProjectKeyInGeneratedFilePath => _includeProjectKeyInGeneratedFilePath ?? _defaults.IncludeProjectKeyInGeneratedFilePath;
39+
public override bool MonitorWorkspaceFolderForConfigurationFiles => _monitorWorkspaceFolderForConfigurationFiles ?? _defaults.MonitorWorkspaceFolderForConfigurationFiles;
3840

3941
public ConfigurableLanguageServerFeatureOptions(string[] args)
4042
{
@@ -57,6 +59,7 @@ public ConfigurableLanguageServerFeatureOptions(string[] args)
5759
TryProcessBoolOption(nameof(UsePreciseSemanticTokenRanges), ref _usePreciseSemanticTokenRanges, option, args, i);
5860
TryProcessBoolOption(nameof(UpdateBuffersForClosedDocuments), ref _updateBuffersForClosedDocuments, option, args, i);
5961
TryProcessBoolOption(nameof(IncludeProjectKeyInGeneratedFilePath), ref _includeProjectKeyInGeneratedFilePath, option, args, i);
62+
TryProcessBoolOption(nameof(MonitorWorkspaceFolderForConfigurationFiles), ref _monitorWorkspaceFolderForConfigurationFiles, option, args, i);
6063
}
6164
}
6265

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ public override bool ReturnCodeActionAndRenamePathsWithPrefixedSlash
3838
public override bool IncludeProjectKeyInGeneratedFilePath => false;
3939

4040
public override bool UsePreciseSemanticTokenRanges => false;
41+
42+
public override bool MonitorWorkspaceFolderForConfigurationFiles => true;
4143
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,13 @@ internal abstract class LanguageServerFeatureOptions
3434
/// ensure a unique file path per project.
3535
/// </summary>
3636
public abstract bool IncludeProjectKeyInGeneratedFilePath { get; }
37+
38+
/// <summary>
39+
/// Whether to monitor the entire workspace folder for any project.razor.bin files
40+
/// </summary>
41+
/// <remarks>
42+
/// When this is off, the language server won't have any project knowledge unless the
43+
/// razor/monitorProjectConfigurationFilePath notification is sent.
44+
/// </remarks>
45+
public abstract bool MonitorWorkspaceFolderForConfigurationFiles { get; }
3746
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@ public VisualStudioWindowsLanguageServerFeatureOptions(LSPEditorFeatureDetector
8080
public override bool IncludeProjectKeyInGeneratedFilePath => _includeProjectKeyInGeneratedFilePath.Value;
8181

8282
public override bool UsePreciseSemanticTokenRanges => _usePreciseSemanticTokenRanges.Value;
83+
84+
public override bool MonitorWorkspaceFolderForConfigurationFiles => false;
8385
}

src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestLanguageServerFeatureOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ public TestLanguageServerFeatureOptions(
4040
public override bool UpdateBuffersForClosedDocuments => false;
4141

4242
public override bool IncludeProjectKeyInGeneratedFilePath => _includeProjectKeyInGeneratedFilePath;
43+
44+
public override bool MonitorWorkspaceFolderForConfigurationFiles => true;
4345
}

0 commit comments

Comments
 (0)