public override void TrackDocument(ITextBuffer buffer)
        {
            if (buffer is null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            Debug.Assert(_joinableTaskContext.IsOnMainThread);

            var uri = _fileUriProvider.GetOrCreate(buffer);

            if (_documents.TryGetValue(uri, out _))
            {
                throw new InvalidOperationException($"Can not track document that's already being tracked {uri}");
            }

            var lspDocument = _documentFactory.Create(buffer);

            _documents[uri] = lspDocument;

            NotifyDocumentManagerChangeListeners(
                old: null,
                @new: lspDocument.CurrentSnapshot,
                virtualOld: null,
                virtualNew: null,
                LSPDocumentChangeKind.Added);
        }
예제 #2
0
        public override void TrackDocument(ITextBuffer buffer)
        {
            if (buffer is null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            Debug.Assert(_joinableTaskContext.IsOnMainThread);

            var uri = _fileUriProvider.GetOrCreate(buffer);

            if (_documents.TryGetValue(uri, out _))
            {
                throw new InvalidOperationException($"Can not track document that's already being tracked {uri}");
            }

            var lspDocument = _documentFactory.Create(buffer);

            _documents[uri] = lspDocument;
            var args = new LSPDocumentChangeEventArgs(old: null, lspDocument.CurrentSnapshot, LSPDocumentChangeKind.Added);

            Changed?.Invoke(this, args);
        }