public void ClearDiagnotics(Uri documentUri) { _languageServer.TextDocument.PublishDiagnostics(new PublishDiagnosticsParams() { Uri = documentUri, Diagnostics = Array.Empty <OmniSharp.Extensions.LanguageServer.Protocol.Models.Diagnostic>() }); }
internal async Task <SyntaxTree> ParseTextDocumentAsync(Uri docUri, CancellationToken cancellationToken) { var source = new List <string>(1) { docUri.GetFileSystemPath() }; var syntaxTrees = await _server.Parse(source, cancellationToken); return(syntaxTrees.FirstOrDefault()); }
internal void DidCloseTextDocument(TextDocumentItem document) { _logger.LogInformation($"Document closed {document.Uri.GetFileSystemPath()} ({document.Version})"); Uri docUri = document.Uri; if (Documents.ContainsKey(docUri)) { Documents.Remove(docUri); } }
internal async Task <Compilation?> ValidateTextDocumentAsync(Uri docUri, CancellationToken cancellationToken) { if (!Documents.ContainsKey(docUri)) { _logger.LogError("File is not open for validation."); return(null); } var doc = Documents[docUri]; doc.Compilation = await _server.Validate(doc.Document.Text, doc.Document.Uri.GetFileSystemPath(), cancellationToken); return(doc.Compilation); }
internal void DidChangeTextDocument(VersionedTextDocumentIdentifier document, Container <TextDocumentContentChangeEvent> changes) { _logger.LogInformation($"Document changed {document.Uri.GetFileSystemPath()} ({document.Version})"); Uri docUri = document.Uri; if (!Documents.ContainsKey(docUri)) { return; } var doc = Documents[docUri]; // We only handle a full document update right now doc.Document.Version = document.Version; doc.Document.Text = changes.First().Text; }
public static DocumentUri ToDefinition(this Uri uri) { string enc = uri.LocalPath.Replace('\\', '/').Replace(" ", "%20").Replace(":", "%3A"); return(DocumentUri.File(uri.LocalPath)); }