Example #1
0
        private IEnumerable <DocumentSymbol> CreateSymbolsOfEntryDocument(ILocalizableSymbol symbol, Boogie.IToken token, SymbolKind kind)
        {
            var children = symbol.Children.SelectMany(Visit);

            if (!IsPartOfEntryDocument(token))
            {
                return(children);
            }
            var documentSymbol = new DocumentSymbol {
                Name     = symbol.Name,
                Kind     = kind,
                Detail   = symbol.GetDetailText(_cancellationToken),
                Children = children.ToArray()
            };

            if (_symbolTable.TryGetLocationOf(symbol, out var location))
            {
                documentSymbol = documentSymbol with {
                    Range          = location.Declaration,
                    SelectionRange = location.Name
                };
            }
            return(new[] { documentSymbol });
        }
    }
 private SignatureInformation CreateSignatureInformation(ILocalizableSymbol symbol)
 {
     return(new SignatureInformation {
         Label = symbol.Name,
         Documentation = new MarkupContent {
             Kind = MarkupKind.Markdown,
             Value = $"```dafny\n{symbol.GetDetailText(_cancellationToken)}\n```"
         },
     });
 }
Example #3
0
 private static Hover CreateHover(ILocalizableSymbol symbol, CancellationToken cancellationToken)
 {
     return(new Hover {
         Contents = new MarkedStringsOrMarkupContent(
             new MarkupContent {
             // TODO It appears that setting plaintext/markdown doesn't make a difference, at least in VSCode.
             Kind = MarkupKind.Markdown,
             Value = $"```dafny\n{symbol.GetDetailText(cancellationToken)}\n```"
         }
             )
     });
 }
Example #4
0
        private IEnumerable <DocumentSymbol> CreateSymbolsOfEntryDocument(ILocalizableSymbol symbol, Boogie.IToken token, SymbolKind kind)
        {
            var children = symbol.Children.SelectMany(Visit);

            if (!IsPartOfEntryDocument(token))
            {
                return(children);
            }
            if (!symbolTable.TryGetLocationOf(symbol, out var location))
            {
                return(Enumerable.Empty <DocumentSymbol>());
            }
            var documentSymbol = new DocumentSymbol {
                Name           = symbol.Name,
                Kind           = kind,
                Children       = children.ToArray(),
                Range          = location.Declaration,
                SelectionRange = location.Name
            };

            return(new[] { documentSymbol });
        }