示例#1
0
        public Document(ITextDocumentFactoryService textDocumentFactory, ITextDocument textDocument, ILexer lexer, IParser parser, OnDestroyAction onDestroy)
        {
            _textDocumentFactory = textDocumentFactory;
            _textDocument        = textDocument;
            _textBuffer          = textDocument.TextBuffer;
            Lexer          = lexer;
            Parser         = parser;
            _destroyAction = onDestroy;
            _cts           = new CancellationTokenSource();

            _tokenizer       = new DocumentTokenizer(_textDocument.TextBuffer, Lexer, _cts.Token);
            DocumentAnalysis = new DocumentAnalysis(this, DocumentTokenizer, Parser);
            Disposed         = false;

            _textDocumentFactory.TextDocumentDisposed += OnTextDocumentDisposed;
            _textBuffer.Changed += BufferChanged;
        }
示例#2
0
        public virtual void Dispose()
        {
            if (Disposed)
            {
                return;
            }

            Cancel();
            _textBuffer.Changed -= BufferChanged;
            _textDocumentFactory.TextDocumentDisposed -= OnTextDocumentDisposed;

            DocumentTokenizer.OnDestroy();
            DocumentAnalysis.OnDestroy();

            Disposed = true;
            _destroyAction.Invoke(this);
        }
示例#3
0
 private void InstructionsUpdated(IInstructionListManager sender, Helpers.AsmType asmType) =>
 DocumentAnalysis.Rescan(RescanReason.InstructionsChanged, UpdateCancellation());