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

Commit c430741

Browse files
jakebaileyMikhail Arkhipov
authored and
Mikhail Arkhipov
committed
Do not allow the analyzer to be reset if the server is still in… (#1778)
(cherry picked from commit c5fb43a)
1 parent 4631ac0 commit c430741

File tree

1 file changed

+9
-0
lines changed
  • src/LanguageServer/Impl/Implementation

1 file changed

+9
-0
lines changed

src/LanguageServer/Impl/Implementation/Server.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public sealed partial class Server : IDisposable {
5151
private IIndexManager _indexManager;
5252

5353
private InitializeParams _initParams;
54+
private bool _initialized;
5455

5556
private bool _watchSearchPaths;
5657
private PathsWatcher _pathsWatcher;
@@ -178,6 +179,8 @@ public async Task InitializedAsync(InitializedParams @params, CancellationToken
178179
ChooseDocumentationSource(sigInfo?.documentationFormat),
179180
sigInfo?.parameterInformation?.labelOffsetSupport == true
180181
);
182+
183+
_initialized = true;
181184
}
182185

183186
public Task Shutdown() {
@@ -257,6 +260,12 @@ private void ResetPathWatcher() {
257260
}
258261

259262
private void ResetAnalyzer() {
263+
if (!_initialized) {
264+
// We haven't yet initialized everything, not even the builtins.
265+
// Resetting here would break things.
266+
return;
267+
}
268+
260269
_log?.Log(TraceEventType.Information, Resources.ReloadingModules);
261270
_services.GetService<PythonAnalyzer>().ResetAnalyzer().ContinueWith(t => {
262271
if (_watchSearchPaths) {

0 commit comments

Comments
 (0)