Esempio n. 1
0
        protected override void Initialize()
        {
            base.Initialize();

            var component = (IComponentModel)GetService(typeof(SComponentModel));

            _adapterFactory       = component.GetService <IVsEditorAdaptersFactoryService>();
            _editorFactoryService = component.GetService <RazorEditorFactoryService>();

            _textManager = (IVsTextManager)GetService(typeof(SVsTextManager));
            _rdt         = (IVsRunningDocumentTable)GetService(typeof(SVsRunningDocumentTable));

            var hr = _rdt.AdviseRunningDocTableEvents(new RdtEvents(this), out uint _cookie);

            ErrorHandler.ThrowOnFailure(hr);
        }
Esempio n. 2
0
        public RazorTextViewConnectionListener(
            RazorEditorFactoryService editorFactoryService,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (editorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(editorFactoryService));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _editorFactoryService = editorFactoryService;
            _workspace            = workspace;

            _foregroundDispatcher = workspace.Services.GetRequiredService <ForegroundDispatcher>();
        }
Esempio n. 3
0
        public BlazorOpenDocumentTracker(
            RazorEditorFactoryService editorFactory,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (editorFactory == null)
            {
                throw new ArgumentNullException(nameof(editorFactory));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _editorFactory = editorFactory;
            _workspace     = workspace;

            _openViews = new HashSet <IWpfTextView>();

            _workspace.WorkspaceChanged += Workspace_WorkspaceChanged;
        }
Esempio n. 4
0
        // This is only for testing. We want to avoid using the actual Roslyn GetService methods in unit tests.
        internal RazorTextViewConnectionListener(
            ForegroundDispatcher foregroundDispatcher,
            RazorEditorFactoryService editorFactoryService,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (editorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(editorFactoryService));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _editorFactoryService = editorFactoryService;
            _workspace            = workspace;
        }