public SignatureHelpProcessor(ISymbolGuesser symbolGuesser, DafnyDocument document, SignatureHelpParams request, CancellationToken cancellationToken)
 {
     _symbolGuesser     = symbolGuesser;
     _document          = document;
     _request           = request;
     _cancellationToken = cancellationToken;
 }
Exemplo n.º 2
0
 public ChangeProcessor(ILogger logger, DafnyDocument originalDocument, Container <TextDocumentContentChangeEvent> contentChanges, CancellationToken cancellationToken)
 {
     _logger            = logger;
     _originalDocument  = originalDocument;
     _contentChanges    = contentChanges;
     _cancellationToken = cancellationToken;
 }
Exemplo n.º 3
0
 public CounterExampleLoader(ILogger logger, DafnyDocument document, int counterExampleDepth, CancellationToken cancellationToken)
 {
     this.logger              = logger;
     this.document            = document;
     this.cancellationToken   = cancellationToken;
     this.counterExampleDepth = counterExampleDepth;
 }
Exemplo n.º 4
0
 public CompletionProcessor(ISymbolGuesser symbolGuesser, DafnyDocument document, CompletionParams request, CancellationToken cancellationToken)
 {
     this.symbolGuesser     = symbolGuesser;
     this.document          = document;
     this.request           = request;
     this.cancellationToken = cancellationToken;
 }
        // The assertion Assert.IsFalse(document.SymbolTable.Resolved) is used to ensure that
        // we're working on a migrated symbol table. If that's not the case, the test case has
        // to be adapted.

        // TODO The Declaration Range currently does not incorporate keywords such as "class" and "var".
        // TODO The "BodyEndToken" used by the CreateDeclarationDictionary.CreateDeclarationDictionary()
        //      does not incorporate the closing braces.

        private bool TryFindSymbolDeclarationByName(DafnyDocument document, string symbolName, out SymbolLocation location)
        {
            location = document.SymbolTable.Locations
                       .WithCancellation(CancellationToken)
                       .Where(entry => entry.Key.Name == symbolName)
                       .Select(entry => entry.Value)
                       .SingleOrDefault();
            return(location != null);
        }
 private LocationOrLocationLink?GetLspLocation(DafnyDocument document, ISymbol symbol)
 {
     if (document.SymbolTable.TryGetLocationOf(symbol, out var location))
     {
         return(new Location {
             Uri = location.Uri,
             Range = location.Name
         });
     }
     return(null);
 }
Exemplo n.º 7
0
        public async Task <DafnyDocument> ApplyChangesAsync(DafnyDocument oldDocument, DidChangeTextDocumentParams documentChange, CancellationToken cancellationToken)
        {
            var changeProcessor = new ChangeProcessor(_logger, oldDocument, documentChange.ContentChanges, cancellationToken);
            var mergedItem      = new TextDocumentItem {
                LanguageId = oldDocument.Text.LanguageId,
                Uri        = oldDocument.Uri,
                Version    = documentChange.TextDocument.Version,
                Text       = changeProcessor.MigrateText()
            };
            var loadedDocument = await _documentLoader.LoadAsync(mergedItem, Verify, cancellationToken);

            if (!loadedDocument.SymbolTable.Resolved)
            {
                return(new DafnyDocument(
                           loadedDocument.Text,
                           loadedDocument.Errors,
                           loadedDocument.Program,
                           changeProcessor.MigrateSymbolTable(),
                           // TODO migrate counterexamples?
                           null
                           ));
            }
            return(loadedDocument);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Gets the path of the file represented by the given dafny document. The path returned is
 /// in the standard system format. E.g. C:\data\test.dfy for windows or /home/test.dfy for linux.
 /// </summary>
 /// <param name="document">The document to get the file path of.</param>
 /// <returns>The file path.</returns>
 public static string GetFilePath(this DafnyDocument document)
 {
     return(GetFilePath(document.Uri));
 }
Exemplo n.º 9
0
 public Guesser(ILogger logger, DafnyDocument document, CancellationToken cancellationToken)
 {
     _logger            = logger;
     _document          = document;
     _cancellationToken = cancellationToken;
 }
Exemplo n.º 10
0
 public bool TryGetTypeBefore(DafnyDocument document, Position position, CancellationToken cancellationToken, [NotNullWhen(true)] out ISymbol?typeSymbol)
 {
     (_, typeSymbol) = new Guesser(_logger, document, cancellationToken).GetSymbolAndItsTypeBefore(position);
     return(typeSymbol != null);
 }
Exemplo n.º 11
0
 public CounterExampleLoader(ILogger logger, DafnyDocument document, CancellationToken cancellationToken)
 {
     _logger            = logger;
     _document          = document;
     _cancellationToken = cancellationToken;
 }
Exemplo n.º 12
0
 public Guesser(ILogger logger, DafnyDocument document, CancellationToken cancellationToken)
 {
     this.logger            = logger;
     this.document          = document;
     this.cancellationToken = cancellationToken;
 }