Beispiel #1
0
        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;
                    }
                }
            }
        }
Beispiel #2
0
 public int GetPart(TextDocumentIdentifier document) => _projectFiles.GetPart(document.uri);
Beispiel #3
0
 public IProjectEntry GetEntry(TextDocumentIdentifier document) => _projectFiles.GetEntry(document.uri);