Пример #1
0
        private void _HandleTextDocumentOpened(object sender, DidOpenTextDocumentParams e)
        {
            WorkspaceDocument document = new WorkspaceDocument(e.TextDocument.LanguageId, e.TextDocument.Text, e.TextDocument.Uri, e.TextDocument.Version);

            _documents.Add(document);

            DocumentOpened?.Invoke(this, document);
        }
Пример #2
0
        private void _HandleTextDocumentClosed(object sender, DidCloseTextDocumentParams e)
        {
            WorkspaceDocument document = _documents.Where(x => x.Uri.Equals(e.TextDocument.Uri)).FirstOrDefault();

            if (document != null)
            {
                _documents.Remove(document);
                DocumentClosed?.Invoke(this, document);
            }
        }
Пример #3
0
        private void _HandleTextDocumentChanged(object sender, DidChangeTextDocumentParams e)
        {
            WorkspaceDocument document = _documents.Where(x => x.Uri.Equals(e.TextDocument.Uri)).FirstOrDefault();

            if (document != null)
            {
                document.ApplyContentChanges(e.ContentChanges, e.TextDocument.Version);
                DocumentChanged?.Invoke(this, document);
            }
        }