public void GetAnalysis(TextDocumentIdentifier document, Position position, int?expectedVersion, out ProjectEntry entry, out PythonAst tree) { entry = GetEntry(document) as ProjectEntry; if (entry == null) { throw new LanguageServerException(LanguageServerException.UnsupportedDocumentType, "unsupported document"); } var parse = entry.GetCurrentParse(); tree = parse?.Tree; if (expectedVersion.HasValue && parse?.Cookie is VersionCookie vc) { if (vc.Versions.TryGetValue(GetPart(document.uri), out var bv)) { if (bv.Version == expectedVersion.Value) { tree = bv.Ast; } } } }
public int GetPart(TextDocumentIdentifier document) => _projectFiles.GetPart(document.uri);
public IProjectEntry GetEntry(TextDocumentIdentifier document) => _projectFiles.GetEntry(document.uri);