@@ -20,10 +20,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer;
20
20
21
21
internal class ProjectConfigurationStateSynchronizer : IProjectConfigurationFileChangeListener
22
22
{
23
- private readonly ProjectSnapshotManagerDispatcher _projectSnapshotManagerDispatcher ;
23
+ private readonly ProjectSnapshotManagerDispatcher _dispatcher ;
24
24
private readonly IRazorProjectService _projectService ;
25
- private readonly LanguageServerFeatureOptions _languageServerFeatureOptions ;
25
+ private readonly LanguageServerFeatureOptions _options ;
26
26
private readonly ILogger _logger ;
27
+
27
28
private readonly Dictionary < string , ProjectKey > _configurationToProjectMap ;
28
29
internal readonly Dictionary < ProjectKey , DelayedProjectInfo > ProjectInfoMap ;
29
30
@@ -33,10 +34,11 @@ public ProjectConfigurationStateSynchronizer(
33
34
ILoggerFactory loggerFactory ,
34
35
LanguageServerFeatureOptions languageServerFeatureOptions )
35
36
{
36
- _projectSnapshotManagerDispatcher = projectSnapshotManagerDispatcher ;
37
+ _dispatcher = projectSnapshotManagerDispatcher ;
37
38
_projectService = projectService ;
38
- _languageServerFeatureOptions = languageServerFeatureOptions ;
39
+ _options = languageServerFeatureOptions ;
39
40
_logger = loggerFactory . GetOrCreateLogger < ProjectConfigurationStateSynchronizer > ( ) ;
41
+
40
42
_configurationToProjectMap = new Dictionary < string , ProjectKey > ( FilePathComparer . Instance ) ;
41
43
ProjectInfoMap = new Dictionary < ProjectKey , DelayedProjectInfo > ( ) ;
42
44
}
@@ -50,14 +52,14 @@ public void ProjectConfigurationFileChanged(ProjectConfigurationFileChangeEventA
50
52
throw new ArgumentNullException ( nameof ( args ) ) ;
51
53
}
52
54
53
- _projectSnapshotManagerDispatcher . AssertRunningOnDispatcher ( ) ;
55
+ _dispatcher . AssertRunningOnDispatcher ( ) ;
54
56
55
57
switch ( args . Kind )
56
58
{
57
59
case RazorFileChangeKind . Changed :
58
60
{
59
61
var configurationFilePath = FilePathNormalizer . Normalize ( args . ConfigurationFilePath ) ;
60
- if ( ! args . TryDeserialize ( _languageServerFeatureOptions , out var projectInfo ) )
62
+ if ( ! args . TryDeserialize ( _options , out var projectInfo ) )
61
63
{
62
64
if ( ! _configurationToProjectMap . TryGetValue ( configurationFilePath , out var lastAssociatedProjectKey ) )
63
65
{
@@ -93,7 +95,7 @@ public void ProjectConfigurationFileChanged(ProjectConfigurationFileChangeEventA
93
95
case RazorFileChangeKind . Added :
94
96
{
95
97
var configurationFilePath = FilePathNormalizer . Normalize ( args . ConfigurationFilePath ) ;
96
- if ( ! args . TryDeserialize ( _languageServerFeatureOptions , out var projectInfo ) )
98
+ if ( ! args . TryDeserialize ( _options , out var projectInfo ) )
97
99
{
98
100
// Given that this is the first time we're seeing this configuration file if we can't deserialize it
99
101
// then we have to noop.
@@ -177,7 +179,7 @@ async Task UpdateAfterDelayAsync(ProjectKey projectKey, CancellationToken cancel
177
179
// ConfigureAwait(true) to make sure we are still running in ProjectSnapshotManagerDispatcher context
178
180
await Task . Delay ( EnqueueDelay ) . ConfigureAwait ( true ) ;
179
181
180
- _projectSnapshotManagerDispatcher . AssertRunningOnDispatcher ( ) ;
182
+ _dispatcher . AssertRunningOnDispatcher ( ) ;
181
183
182
184
var delayedProjectInfo = ProjectInfoMap [ projectKey ] ;
183
185
await UpdateProjectAsync ( projectKey , delayedProjectInfo . ProjectInfo , cancellationToken ) . ConfigureAwait ( false ) ;
0 commit comments