コード例 #1
0
        public override IScanner GetScanner(IVsTextLines buffer)
        {
            //if (m_scanner == null)
            //    m_scanner = new NSScanner(buffer);
            //return m_scanner;
            var model          = (Microsoft.VisualStudio.ComponentModelHost.IComponentModel)GetService(typeof(Microsoft.VisualStudio.ComponentModelHost.SComponentModel));
            var adapterFactory = model.GetService <Microsoft.VisualStudio.Editor.IVsEditorAdaptersFactoryService>();

            //var adapter = _serviceprovider_sys.GetService(typeof(IVsEditorAdaptersFactoryService));
            //var model = GetService(typeof(SComponentModel)) as IComponentModel;
            //var adapter = model.GetService<IVsEditorAdaptersFactoryService>();

            //Source src = GetSource(buffer);
            NSScanner             nsscanner;
            IVsTextBufferProvider buffprov = buffer as IVsTextBufferProvider;

            //adapter.GetDocumentBuffer(srpTextLines);
            Microsoft.VisualStudio.Text.ITextBuffer itb = adapterFactory.GetDocumentBuffer(buffer);
            //it2.add
            if (!itb.Properties.ContainsProperty("scanner_added"))
            {
                nsscanner = new NSScanner(buffer);
                itb.Properties.AddProperty("scanner_added", nsscanner);
            }
            return((NSScanner)itb.Properties.GetProperty("scanner_added"));
            //return null;
            //return new NSScanner(buffer);
        }
コード例 #2
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            PhpProjectionBuffer projectionBuffer;

            if (buffer.Properties.TryGetProperty(typeof(PhpProjectionBuffer), out projectionBuffer))
            {
                return(null);
            }

            return((ITagger <T>) new ContentTypeTagger(buffer, ContentTypeRegistryService));
        }
コード例 #3
0
        public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            try
            {
                IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
                if (view == null)
                {
                    return;
                }

                view.Closed += OnViewClosed;
                Microsoft.VisualStudio.Text.ITextBuffer buffer = view.TextBuffer;
                if (buffer == null)
                {
                    return;
                }

                string ffn = await buffer.GetFFN();

                if (ffn == null)
                {
                    return;
                }

                if (!(Path.GetExtension(ffn) == ".g4" || Path.GetExtension(ffn) == ".g"))
                {
                    return;
                }

                if (!Options.Option.GetBoolean("OverrideAntlrPluggins"))
                {
                    return;
                }

                IContentType content_type = buffer.ContentType;
                System.Collections.Generic.List <IContentType> content_types = ContentTypeRegistryService.ContentTypes.ToList();
                IContentType new_content_type       = content_types.Find(ct => ct.TypeName == "Antlr");
                Type         type_of_content_type   = new_content_type.GetType();
                System.Reflection.Assembly assembly = type_of_content_type.Assembly;
                buffer.ChangeContentType(new_content_type, null);
                if (!PreviousContentType.ContainsKey(ffn))
                {
                    PreviousContentType[ffn] = content_type;
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #4
0
        internal static bool IsSortAndRemoveImportsSupported(Document document, Microsoft.VisualStudio.Text.ITextBuffer textBuffer)
        {
            var workspace = document.Project.Solution.Workspace;

            if (!workspace.CanApplyChange(ApplyChangesKind.ChangeDocument))
            {
                return(false);
            }

            if (workspace.Kind == WorkspaceKind.MiscellaneousFiles)
            {
                return(false);
            }

            return(workspace.Services.GetService <ITextBufferSupportsFeatureService> ().SupportsRefactorings(textBuffer));
        }
コード例 #5
0
 public SimpleTagger <ErrorTag> GetErrorTagger(Microsoft.VisualStudio.Text.ITextBuffer textBuffer)
 {
     return(textBuffer.Properties.GetOrCreateSingletonProperty <SimpleTagger <ErrorTag> >(
                () => new SimpleTagger <ErrorTag>(textBuffer)
                ));
 }
コード例 #6
0
 public SimpleTagger <ErrorTag> GetErrorTagger(Microsoft.VisualStudio.Text.ITextBuffer textBuffer)
 {
     return(_instance = _instance ?? new SimpleTagger <ErrorTag>(textBuffer));
 }
コード例 #7
0
 public Microsoft.VisualStudio.Text.ITrackingPoint GetTriggerPoint(Microsoft.VisualStudio.Text.ITextBuffer textBuffer)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
 {
     return new GoQuickInfoSource(textBuffer, this);
 }
 public IEditorNavigationSource TryCreateEditorNavigationSource(ITextBuffer textBuffer)
 {
     return new PhpEditorNavigationSource(textBuffer, this);
 }
コード例 #10
0
 public IEditorNavigationSource TryCreateEditorNavigationSource(ITextBuffer textBuffer)
 {
     return(new PhpEditorNavigationSource(textBuffer, this));
 }
コード例 #11
0
 public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
 {
     // this functionality is currently disabled
     return null;
 }
コード例 #12
0
 public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
 {
     // this functionality is currently disabled
     return(null);
 }
コード例 #13
0
        protected override IClassifier GetClassifierImpl(ITextBuffer textBuffer)
        {
            Contract.Requires(textBuffer != null);

            throw new NotImplementedException();
        }
コード例 #14
0
 public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
 {
     return new GoQuickInfoSource(textBuffer, this);
 }
コード例 #15
0
        public ITagger <T> CreateTagger <T>(Microsoft.VisualStudio.Text.ITextBuffer buffer) where T : ITag
        {
            Func <ITagger <T> > sc = delegate() { return(new OutliningTagger(buffer) as ITagger <T>); };

            return(buffer.Properties.GetOrCreateSingletonProperty <ITagger <T> >(sc));
        }
コード例 #16
0
        public ITagger <T> CreateTagger <T>(Microsoft.VisualStudio.Text.Editor.ITextView textView, Microsoft.VisualStudio.Text.ITextBuffer buffer) where T : ITag
        {
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            IClassificationType classificationType = ClassificationTypeRegistryService.GetClassificationType("paste-to-target-clasification");
            var instance = textView.Properties.GetOrCreateSingletonProperty <PasteToTargetHighlight>(delegate
            {
                return(new PasteToTargetHighlight(textView, classificationType));
            });

            return(instance as ITagger <T>);
        }
コード例 #17
0
 public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
 {
     return(new JavaQuickInfoSource(textBuffer, this));
 }
コード例 #18
0
        public ITagger <T> CreateTagger <T>(Microsoft.VisualStudio.Text.Editor.ITextView textView, Microsoft.VisualStudio.Text.ITextBuffer buffer) where T : ITag
        {
            if (buffer == null || textView == null)
            {
                return(null);
            }

            //make sure we are tagging only the top buffer
            if (buffer == textView.TextBuffer)
            {
                if (!taggers.ContainsKey(textView))
                {
                    taggers[textView] = new TodoTagger(textView);
                }
                return(taggers[textView] as ITagger <T>);
            }
            else
            {
                return(null);
            }
        }