Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 98c13ff

Browse files
author
Mikhail Arkhipov
committed
Merge fix
1 parent 7776306 commit 98c13ff

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/LanguageServer/Impl/LanguageServer.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,7 @@ public async Task DidChangeConfiguration(JToken token, CancellationToken cancell
152152
_idleTimeTracker?.Dispose();
153153
_idleTimeTracker = new IdleTimeTracker(settings.diagnosticPublishDelay, PublishPendingDiagnostics);
154154

155-
_pathsWatcher?.Dispose();
156-
var watchSearchPaths = GetSetting(analysis, "watchSearchPaths", true);
157-
if (watchSearchPaths) {
158-
if (!_searchPaths.SetEquals(_initParams.initializationOptions.searchPaths)) {
159-
_pathsWatcher = new PathsWatcher(
160-
_initParams.initializationOptions.searchPaths,
161-
() => _server.ReloadModulesAsync(CancellationToken.None).DoNotWait(),
162-
_server
163-
);
164-
}
165-
}
155+
HandlePathWatchChange(token);
166156

167157
var errors = GetSetting(analysis, "errors", Array.Empty<string>());
168158
var warnings = GetSetting(analysis, "warnings", Array.Empty<string>());

src/LanguageServer/Impl/PathsWatcher.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public PathsWatcher(string[] paths, Action onChanged, ILogger log) {
6262
fsw.Deleted += OnChanged;
6363

6464
_disposableBag
65+
.Add(() => _throttleTimer?.Dispose())
6566
.Add(() => fsw.Created -= OnChanged)
6667
.Add(() => fsw.Deleted -= OnChanged)
6768
.Add(() => fsw.EnableRaisingEvents = false)
@@ -83,7 +84,7 @@ private void OnChanged(object sender, FileSystemEventArgs e) {
8384

8485
private void TimerProc(object o) {
8586
lock (_lock) {
86-
if (_changedSinceLastTick) {
87+
if (!_changedSinceLastTick) {
8788
ThreadPool.QueueUserWorkItem(_ => _onChanged());
8889
_throttleTimer?.Dispose();
8990
_throttleTimer = null;

0 commit comments

Comments
 (0)