Beispiel #1
0
        void Response(AsyncServerMessage msg)
        {
            Debug.Assert(msg.FileId >= 0);
            ITextBuffer textBuffer = _textBuffer;

            switch (msg)
            {
            case OutliningCreated outlining:
                var tegget = (OutliningTagger)textBuffer.Properties.GetProperty(Constants.OutliningTaggerKey);
                tegget.Update(outlining);
                break;

            case KeywordsHighlightingCreated keywordHighlighting:
                UpdateSpanInfos(HighlightingType.Keyword, keywordHighlighting.spanInfos, keywordHighlighting.Version);
                break;

            case SymbolsHighlightingCreated symbolsHighlighting:
                UpdateSpanInfos(HighlightingType.Symbol, symbolsHighlighting.spanInfos, symbolsHighlighting.Version);
                break;

            case MatchedBrackets matchedBrackets:
                if (_activeTextViewModelOpt == null)
                {
                    return;
                }

                _activeTextViewModelOpt.Update(matchedBrackets);
                break;

            case ParsingMessages parsingMessages:
                UpdateCompilerMessages(0, parsingMessages.messages, parsingMessages.Version);
                break;

            case MappingMessages mappingMessages:
                UpdateCompilerMessages(1, mappingMessages.messages, mappingMessages.Version);
                break;

            case SemanticAnalysisMessages semanticAnalysisMessages:
                UpdateCompilerMessages(2, semanticAnalysisMessages.messages, semanticAnalysisMessages.Version);
                break;

            case Hint hint:
                _mouseHoverTextViewModelOpt?.ShowHint(hint);
                break;

            case CompleteWord completeWord:
                if (_completionSession != null)
                {
                    _completionSession.Properties[Constants.NitraCompleteWord] = completeWord;
                    if (_completionSession.IsStarted)
                    {
                        _completionSession.Recalculate();
                    }
                    else
                    {
                        _completionSession.Start();
                    }
                }
                break;
            }
        }
Beispiel #2
0
        void Response(AsyncServerMessage msg)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (_disposed)
            {
                ReportDisposed();
                return;
            }

            Debug.Assert(msg.FileId >= 0);
            ITextBuffer textBuffer = _textBuffer;

            switch (msg)
            {
            case OutliningCreated outlining:
                if (textBuffer.Properties.TryGetProperty(Constants.OutliningTaggerKey, out OutliningTagger tegget))
                {
                    tegget.Update(outlining);
                }
                break;

            case KeywordsHighlightingCreated keywordHighlighting:
                UpdateSpanInfos(HighlightingType.Keyword, keywordHighlighting.spanInfos, keywordHighlighting.Version);
                break;

            case SymbolsHighlightingCreated symbolsHighlighting:
                UpdateSpanInfos(HighlightingType.Symbol, symbolsHighlighting.spanInfos, symbolsHighlighting.Version);
                break;

            case MatchedBrackets matchedBrackets:
                if (_activeTextViewModelOpt == null)
                {
                    return;
                }

                _activeTextViewModelOpt.Update(matchedBrackets);
                break;

            case ParsingMessages parsingMessages:
                UpdateCompilerMessages(0, parsingMessages.messages, parsingMessages.Version);
                break;

            case MappingMessages mappingMessages:
                UpdateCompilerMessages(1, mappingMessages.messages, mappingMessages.Version);
                break;

            case SemanticAnalysisMessages semanticAnalysisMessages:
                UpdateCompilerMessages(2, semanticAnalysisMessages.messages, semanticAnalysisMessages.Version);
                break;

            case Hint hint:
                if (_hintCompletion == null)
                {
                    break;
                }
                _hintCompletion.SetResult(hint);
                _hintCancellationTokenRegistration.Dispose();
                _hintCompletion = null;
                break;

            case CompleteWord completeWord:
                if (_completionSession != null)
                {
                    _completionSession.Properties[Constants.NitraCompleteWord] = completeWord;
                    if (_completionSession.IsStarted)
                    {
                        _completionSession.Recalculate();
                    }
                    else
                    {
                        _completionSession.Start();
                    }
                }
                break;
            }
        }