public StreamingFindUsagesPresenter(
            IThreadingContext threadingContext,
            VisualStudioWorkspace workspace,
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            IClassificationFormatMapService classificationFormatMapService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            [ImportMany] IEnumerable <ITableColumnDefinition> columns)
            : base(threadingContext)
        {
            _workspace                 = workspace;
            _serviceProvider           = serviceProvider;
            TextBufferFactoryService   = textBufferFactoryService;
            ContentTypeRegistryService = contentTypeRegistryService;

            TextEditorFactoryService = textEditorFactoryService;
            TypeMap                        = typeMap;
            FormatMapService               = formatMapService;
            ClassificationFormatMap        = classificationFormatMapService.GetClassificationFormatMap("tooltip");
            ProjectionBufferFactoryService = projectionBufferFactoryService;
            EditorOptionsFactoryService    = editorOptionsFactoryService;

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
            _customColumns = columns.OfType <AbstractFindUsagesCustomColumnDefinition>().ToImmutableArray();
        }
        public StreamingFindReferencesPresenter(
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
        {
            _serviceProvider = serviceProvider;
            _textBufferFactoryService = textBufferFactoryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _contentTypeRegistryService = contentTypeRegistryService;

            _textEditorFactoryService = textEditorFactoryService;
            _typeMap = typeMap;
            _formatMapService = formatMapService;

            _asyncListener = new AggregateAsynchronousOperationListener(
                asyncListeners, FeatureAttribute.ReferenceHighlighting);

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }
Ejemplo n.º 3
0
        public StreamingFindUsagesPresenter(
            IThreadingContext threadingContext,
            VisualStudioWorkspace workspace,
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            IClassificationFormatMapService classificationFormatMapService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService)
            : base(threadingContext)
        {
            _workspace                 = workspace;
            _serviceProvider           = serviceProvider;
            TextBufferFactoryService   = textBufferFactoryService;
            ContentTypeRegistryService = contentTypeRegistryService;

            TextEditorFactoryService = textEditorFactoryService;
            TypeMap                        = typeMap;
            FormatMapService               = formatMapService;
            ClassificationFormatMap        = classificationFormatMapService.GetClassificationFormatMap("tooltip");
            ProjectionBufferFactoryService = projectionBufferFactoryService;
            EditorOptionsFactoryService    = editorOptionsFactoryService;

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }
        public StreamingFindReferencesPresenter(
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            [ImportMany] IEnumerable <Lazy <IAsynchronousOperationListener, FeatureMetadata> > asyncListeners)
        {
            _serviceProvider                = serviceProvider;
            _textBufferFactoryService       = textBufferFactoryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService    = editorOptionsFactoryService;
            _contentTypeRegistryService     = contentTypeRegistryService;

            _textEditorFactoryService = textEditorFactoryService;
            _typeMap          = typeMap;
            _formatMapService = formatMapService;

            _asyncListener = new AggregateAsynchronousOperationListener(
                asyncListeners, FeatureAttribute.ReferenceHighlighting);

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }
        public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (pguidCmdGroup == _vSStd97CmdIDGuid && nCmdID == (uint)VSConstants.VSStd97CmdID.GotoDefn)
            {
                TextView.TextBuffer.Properties.TryGetProperty <ITextDocument>(typeof(ITextDocument), out ITextDocument textDoc);

                if (PackageCompletionSource.IsInRangeForPackageCompletion(TextView.TextSnapshot, TextView.Caret.Position.BufferPosition.Position, out Span targetSpan, out string packageName, out string packageVersion, out string completionType))
                {
                    if (PackageExistsOnNuGet(packageName, packageVersion, out string url))
                    {
                        System.Diagnostics.Process.Start(url);
                        return(VSConstants.S_OK);
                    }
                }

                IWorkspace        workspace   = _workspaceManager.GetWorkspace(textDoc.FilePath);
                List <Definition> definitions = workspace.ResolveDefinition(textDoc.FilePath, TextView.TextSnapshot.GetText(), TextView.Caret.Position.BufferPosition.Position);

                if (definitions.Count == 1)
                {
                    DTE dte = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE;
                    dte.MainWindow.Activate();

                    using (var state = new NewDocumentStateScope(Microsoft.VisualStudio.Shell.Interop.__VSNEWDOCUMENTSTATE.NDS_Provisional, Guid.Parse(ProjectFileToolsPackage.PackageGuidString)))
                    {
                        EnvDTE.Window w = dte.ItemOperations.OpenFile(definitions[0].File, EnvDTE.Constants.vsViewKindTextView);

                        if (definitions[0].Line.HasValue)
                        {
                            ((EnvDTE.TextSelection)dte.ActiveDocument.Selection).GotoLine(definitions[0].Line.Value, true);
                        }
                    }

                    return(VSConstants.S_OK);
                }

                else if (definitions.Count > 1)
                {
                    IFindAllReferencesService farService = (IFindAllReferencesService)Package.GetGlobalService(typeof(SVsFindAllReferences));
                    FarDataSource             dataSource = new FarDataSource(1);
                    dataSource.Snapshots[0] = new FarDataSnapshot(definitions);

                    IFindAllReferencesWindow farWindow   = farService.StartSearch(definitions[0].Type);
                    ITableManager            _farManager = farWindow.Manager;
                    _farManager.AddSource(dataSource);

                    dataSource.Sink.IsStable = false;
                    dataSource.Sink.AddSnapshot(dataSource.Snapshots[0]);
                    dataSource.Sink.IsStable = true;

                    return(VSConstants.S_OK);
                }
            }

            return(Next?.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut) ?? (int)Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED);
        }
        private StreamingFindUsagesPresenter(
            IMSBuildEditorHost host,
            Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider,
            IEditorFormatMapService formatMapService,
            IClassificationFormatMapService classificationFormatMapService,
            IClassificationTypeRegistryService classificationTypeRegistry,
            IEnumerable <ITableColumnDefinition> columns)
        {
            Host                       = host;
            _serviceProvider           = serviceProvider;
            FormatMapService           = formatMapService;
            ClassificationFormatMap    = classificationFormatMapService.GetClassificationFormatMap("tooltip");
            ClassificationTypeRegistry = classificationTypeRegistry;

            _vsFindAllReferencesService = serviceProvider.GetService <SVsFindAllReferences, IFindAllReferencesService> (true);
            _customColumns = columns.OfType <AbstractFindUsagesCustomColumnDefinition> ().ToImmutableArray();
        }
Ejemplo n.º 7
0
        private static int ShowInFar(string title, List <Definition> definitions)
        {
            IFindAllReferencesService farService = ServiceUtil.GetService <SVsFindAllReferences, IFindAllReferencesService>();
            FarDataSource             dataSource = new FarDataSource(1);

            dataSource.Snapshots[0] = new FarDataSnapshot(definitions);

            IFindAllReferencesWindow farWindow   = farService.StartSearch(title);
            ITableManager            _farManager = farWindow.Manager;

            _farManager.AddSource(dataSource);

            dataSource.Sink.IsStable = false;
            dataSource.Sink.AddSnapshot(dataSource.Snapshots[0]);
            dataSource.Sink.IsStable = true;

            return(VSConstants.S_OK);
        }
Ejemplo n.º 8
0
        private StreamingFindUsagesPresenter(
            Workspace workspace,
            IThreadingContext threadingContext,
            Shell.SVsServiceProvider serviceProvider,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            IClassificationFormatMapService classificationFormatMapService,
            IEnumerable <ITableColumnDefinition> columns)
            : base(threadingContext)
        {
            _workspace              = workspace;
            _serviceProvider        = serviceProvider;
            TypeMap                 = typeMap;
            FormatMapService        = formatMapService;
            ClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("tooltip");

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
            _customColumns = columns.OfType <AbstractFindUsagesCustomColumnDefinition>().ToImmutableArray();
        }
        public StreamingFindUsagesPresenter(
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService)
        {
            _serviceProvider                = serviceProvider;
            _textBufferFactoryService       = textBufferFactoryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService    = editorOptionsFactoryService;
            _contentTypeRegistryService     = contentTypeRegistryService;

            _textEditorFactoryService = textEditorFactoryService;
            _typeMap          = typeMap;
            _formatMapService = formatMapService;

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }
Ejemplo n.º 10
0
        public StreamingFindUsagesPresenter(
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService)
        {
            _serviceProvider = serviceProvider;
            _textBufferFactoryService = textBufferFactoryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _contentTypeRegistryService = contentTypeRegistryService;

            _textEditorFactoryService = textEditorFactoryService;
            _typeMap = typeMap;
            _formatMapService = formatMapService;

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }
Ejemplo n.º 11
0
        public StreamingFindUsagesPresenter(
            VisualStudioWorkspace workspace,
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            DeferredContentFrameworkElementFactory frameworkElementFactory,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            IClassificationFormatMapService classificationFormatMapService)
        {
            _workspace                             = workspace;
            _serviceProvider                       = serviceProvider;
            TextBufferFactoryService               = textBufferFactoryService;
            ContentTypeRegistryService             = contentTypeRegistryService;
            DeferredContentFrameworkElementFactory = frameworkElementFactory;

            TextEditorFactoryService = textEditorFactoryService;
            TypeMap                 = typeMap;
            FormatMapService        = formatMapService;
            ClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("tooltip");

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }