コード例 #1
0
ファイル: QuickInfoSource.cs プロジェクト: mrvux/AmmyUI
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            var subjectTriggerPoint = session.GetTriggerPoint(_buffer.CurrentSnapshot);

            if (!subjectTriggerPoint.HasValue)
            {
                applicableToSpan = null;
                return;
            }

            var currentSnapshot = subjectTriggerPoint.Value.Snapshot;

            //look for occurrences of our QuickInfo words in the span
            var navigator = NavigatorService.GetTextStructureNavigator(_buffer);
            var extent    = navigator.GetExtentOfWord(subjectTriggerPoint.Value);
            var result    = _compilerService.LatestResult?.GetFile(_document.FilePath);

            applicableToSpan = null;

            if (result == null)
            {
                return;
            }

            bool foundSomething;

            SpanToSymbol(quickInfoContent, new NSpan(extent.Span.Start, extent.Span.End), result.Ast, out foundSomething);

            if (foundSomething)
            {
                applicableToSpan = currentSnapshot.CreateTrackingSpan(extent.Span.Start, extent.Span.Length, SpanTrackingMode.EdgeInclusive);
            }
        }
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
        {
            var           navigator = NavigatorService.GetTextStructureNavigator(wpfTextView.TextBuffer);
            ITextDocument textDocument;

            TextDocumentFactoryService.TryGetTextDocument(wpfTextView.TextBuffer, out textDocument);
            return(new ImagePreviewToolTipMouseProcessor(wpfTextView, navigator, ToolTipProviderFactory, textDocument));
        }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = AdapterService.GetWpfTextView(textViewAdapter);

            if (textView != null)
            {
                var textNavigator = NavigatorService.GetTextStructureNavigator(textView.TextBuffer);

                textView.Properties.GetOrCreateSingletonProperty(() =>
                                                                 new CommandFilter(textViewAdapter, textView, textNavigator, SignatureHelpBroker));
            }
        }
コード例 #4
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }

            textView.Properties.GetOrCreateSingletonProperty(
                () => new ProbeSignatureHelpCommandHandler(textViewAdapter,
                                                           textView,
                                                           NavigatorService.GetTextStructureNavigator(textView.TextBuffer),
                                                           SignatureHelpBroker,
                                                           this));
        }
コード例 #5
0
ファイル: B4SmartTag.cs プロジェクト: Getequ/B4Refactoring
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (buffer == null || textView == null)
            {
                return(null);
            }

            if (buffer == textView.TextBuffer)
            {
                ITextStructureNavigator textStructureNavigator = NavigatorService.GetTextStructureNavigator(buffer);

                return(new B4SmartTagger(buffer, textView, this, TextSearchService, textStructureNavigator,
                                         (DTE)ServiceProvider.GetService(typeof(DTE))) as ITagger <T>);
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IVsTextLines textlines;

            textViewAdapter.GetBuffer(out textlines);
            if (textlines != null)
            {
                Guid langId;
                textlines.GetLanguageServiceID(out langId);
                IWpfTextView textView = AdaptersFactory.GetWpfTextView(textViewAdapter);
                Debug.Assert(textView != null);
                // Note that this may get called after the classifier has been instantiated

                if (langId == GuidStrings.guidLanguageService)          // is our language service active ?
                {
                    string fileName = FilePathUtilities.GetFilePath(textlines);
                    if (!IsOurSourceFile(fileName))       // is this a file node from Vulcan ?
                    {
                        // we always register the file in the classifier.
                        if (textView.TextBuffer.Properties.ContainsProperty(typeof(XSharpModel.XFile)))
                        {
                            textView.TextBuffer.Properties.RemoveProperty(typeof(XSharpModel.XFile));
                        }

                        Guid guidVulcanLanguageService = GuidStrings.guidVulcanLanguageService;
                        textlines.SetLanguageServiceID(guidVulcanLanguageService);
                        return;
                    }
                    //
                    // Only capturing keystroke for OUR languageService... ???
                    //

                    // Get XFile and assign it to the textbuffer
                    if (!textView.TextBuffer.Properties.ContainsProperty(typeof(XSharpModel.XFile)))
                    {
                        var file = XSharpModel.XSolution.FindFile(fileName);
                        if (file != null)
                        {
                            textView.TextBuffer.Properties.AddProperty(typeof(XSharpModel.XFile), file);
                        }
                    }
                    CommandFilter     filter = new CommandFilter(textView, CompletionBroker, NavigatorService.GetTextStructureNavigator(textView.TextBuffer), SignatureHelpBroker, aggregator, this);
                    IOleCommandTarget next;
                    textViewAdapter.AddCommandFilter(filter, out next);
                    filter.Next = next;
                }
            }
        }
コード例 #7
0
        public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
        {
            ISQLanguageService service = SQVSUtils.GetService <ISQLanguageService>();

            return(new SQCompletionSource(GlyphService, NavigatorService.GetTextStructureNavigator(textBuffer), textBuffer, service as SQLanguageServiceEX));
        }
コード例 #8
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            var textView = AdapterService.GetWpfTextView(textViewAdapter);

            textView?.Properties.GetOrCreateSingletonProperty(() => new SignatureHelpCommandHandler(textViewAdapter,
                                                                                                    textView,
                                                                                                    NavigatorService.GetTextStructureNavigator(textView.TextBuffer),
                                                                                                    SignatureHelpBroker));
        }
コード例 #9
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            Parser.Project parsedproject = null;
            var            buffer        = textView.TextBuffer;

            IVsTextBuffer bufferAdapter;

            buffer.Properties.TryGetProperty(typeof(IVsTextBuffer), out bufferAdapter);

            var persist = (IPersistFileFormat)bufferAdapter;

            if (persist != null)
            {
                string filename    = null;
                uint   formatindex = 0;
                if (persist.GetCurFile(out filename, out formatindex) == VSConstants.S_OK)
                {
                    var doctable  = new RunningDocumentTable(ServiceProvider);
                    var hierarchy = doctable.GetHierarchyItem(filename);
                    if (hierarchy != null)
                    {
                        parsedproject = Parser.ProjectMapper.GetInstance().Map(hierarchy);
                    }
                }
            }

            if (!buffer.Properties.ContainsProperty(typeof(Parser.Project)))
            {
                buffer.Properties.AddProperty(typeof(Parser.Project), parsedproject);
            }


            Func <EpochCompletionCommandHandler> createCommandHandler = delegate()
            {
                return(new EpochCompletionCommandHandler(textViewAdapter, textView, this, SignatureHelpBroker, NavigatorService.GetTextStructureNavigator(textView.TextBuffer)));
            };

            textView.Properties.GetOrCreateSingletonProperty(createCommandHandler);
        }