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

[WIP] Fix cache looping #1763

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ public bool Invalidate(ImmutableArray<IPythonModule> analysisDependencies, int a
}

var dependenciesHashSet = new HashSet<AnalysisModuleKey>();
foreach (var dependency in analysisDependencies) {
if (dependency != module && (dependency.ModuleType == ModuleType.User && dependency.Analysis.Version < version || dependency.Analysis is EmptyAnalysis)) {
foreach (var dependency in analysisDependencies.ExcludeDefault().Where(d => !(d.IsPersistent || d.IsSpecialized))) {
if (!dependency.Equals(module) &&
(dependency.ModuleType == ModuleType.User && dependency.Analysis.Version < version || dependency.Analysis is EmptyAnalysis)) {
dependenciesHashSet.Add(new AnalysisModuleKey(dependency));
}
}
Expand Down
26 changes: 11 additions & 15 deletions src/LanguageServer/Impl/LanguageServer.Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,17 @@ private ImmutableArray<string> GetUserConfiguredPaths(JToken pythonSection) {
private const string DefaultCachingLevel = "None";

private AnalysisCachingLevel GetAnalysisCachingLevel(JToken analysisKey) {
// TODO: Remove this one caching is working at any level again.
// https://github.com/microsoft/python-language-server/issues/1758
return AnalysisCachingLevel.None;

// var s = GetSetting(analysisKey, "cachingLevel", DefaultCachingLevel);
//
// if (string.IsNullOrWhiteSpace(s) || s.EqualsIgnoreCase("Default")) {
// s = DefaultCachingLevel;
// }
//
// if (s.EqualsIgnoreCase("System")) {
// return AnalysisCachingLevel.System;
// }
//
// return s.EqualsIgnoreCase("Library") ? AnalysisCachingLevel.Library : AnalysisCachingLevel.None;
var s = GetSetting(analysisKey, "cachingLevel", DefaultCachingLevel);

if (string.IsNullOrWhiteSpace(s) || s.EqualsIgnoreCase("Default")) {
s = DefaultCachingLevel;
}

if (s.EqualsIgnoreCase("System")) {
return AnalysisCachingLevel.System;
}

return s.EqualsIgnoreCase("Library") ? AnalysisCachingLevel.Library : AnalysisCachingLevel.None;
}
}
}