public HostFactory( IVim vim, IVsEditorAdaptersFactoryService adaptersFactory, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, ITextManager textManager, IVsAdapter adapter, IVimProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IEditorToSettingsSynchronizer editorToSettingSynchronizer, [ImportMany] IEnumerable<Lazy<ICommandTargetFactory, IOrderable>> commandTargetFactoryList) { _vim = vim; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _textManager = textManager; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; _editorToSettingSynchronizer = editorToSettingSynchronizer; _commandTargetFactoryList = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection(); #if DEBUG VimTrace.TraceSwitch.Level = TraceLevel.Info; #endif }
public DocumentProvider( IVisualStudioHostProjectContainer projectContainer, IServiceProvider serviceProvider, bool signUpForFileChangeNotification) { var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); _projectContainer = projectContainer; this.RunningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable)); this.EditorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>(); this.ContentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>(); _textUndoHistoryRegistry = componentModel.GetService<ITextUndoHistoryRegistry>(); _textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager)); // In the CodeSense scenario we will receive file change notifications from the native // Language Services, so we don't want to sign up for them ourselves. if (signUpForFileChangeNotification) { _fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx)); } var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell)); if (shell == null) { // This can happen only in tests, bail out. return; } int installed; Marshal.ThrowExceptionForHR(shell.IsPackageInstalled(Guids.RoslynPackageId, out installed)); IsRoslynPackageInstalled = installed != 0; var runningDocumentTableForEvents = (IVsRunningDocumentTable)RunningDocumentTable; Marshal.ThrowExceptionForHR(runningDocumentTableForEvents.AdviseRunningDocTableEvents(new RunningDocTableEventsSink(this), out _runningDocumentTableEventCookie)); }
/// <summary> /// Default ctor /// </summary> protected XmlResourceCompletionSource(ITextBuffer textBuffer, SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService, IGlyphService glyphService) { this.textBuffer = textBuffer; this.serviceProvider = serviceProvider; this.vsEditorAdaptersFactoryService = vsEditorAdaptersFactoryService; this.glyphService = glyphService; }
public HostFactory( IVim vim, ITextBufferFactoryService bufferFactoryService, ITextEditorFactoryService editorFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IKeyBindingService keyBindingService, SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService adaptersFactory, IResharperUtil resharperUtil, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, ITextManager textManager, IVsAdapter adapter, [EditorUtilsImport] IProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil) { _vim = vim; _keyBindingService = keyBindingService; _bufferFactoryService = bufferFactoryService; _editorFactoryService = editorFactoryService; _editorOptionsFactoryService = editorOptionsFactoryService; _resharperUtil = resharperUtil; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _textManager = textManager; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; #if DEBUG VimTrace.TraceSwitch.Level = TraceLevel.Info; #endif }
public HostFactory( IVim vim, ITextBufferFactoryService bufferFactoryService, ITextEditorFactoryService editorFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IKeyBindingService keyBindingService, SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService adaptersFactory, IResharperUtil resharperUtil, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, IVsAdapter adapter, IProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory) { _vim = vim; _keyBindingService = keyBindingService; _bufferFactoryService = bufferFactoryService; _editorFactoryService = editorFactoryService; _editorOptionsFactoryService = editorOptionsFactoryService; _resharperUtil = resharperUtil; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; _vim.AutoLoadVimRc = false; }
public OutliningFilterProvider( [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorFactory) { _serviceProvider = serviceProvider; _editorFactory = editorFactory; }
public FormatCommentHandler( IVsEditorAdaptersFactoryService adaptersFactoryService, ICommentFormatter commentFormatter) { _adaptersFactoryService = adaptersFactoryService; _commentFormatter = commentFormatter; }
public VsInteractiveWindowEditorFactoryService(IVsEditorAdaptersFactoryService adaptersFactory, IContentTypeRegistryService contentTypeRegistry, [ImportMany]IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders) { _adapterFactory = adaptersFactory; _provider = (IOleServiceProvider)InteractiveWindowPackage.GetGlobalService(typeof(IOleServiceProvider)); _contentTypeRegistry = contentTypeRegistry; _oleCommandTargetProviders = oleCommandTargetProviders; }
public ViewCreationListener( IVsEditorAdaptersFactoryService adaptersFactory, CopyDataService copyDataService) { this.adaptersFactory = adaptersFactory; this.copyDataService = copyDataService; }
public static CommandTargetToOleShim ConnectController(IVsEditorAdaptersFactoryService adapterService, ITextView textView, Controller controller) { IVsTextView viewAdapter = adapterService.GetViewAdapter(textView); CommandTargetToOleShim oleControllerShim = null; // Connect main controller to VS text view filter chain. // The chain looks like VS IDE -> language main controller -> Core editor // However, IDE wants IOleCommandTarget and core editor, although managed, // is represented by OLE command target as well. Since R controller // is not specific to VS and does not use OLE, we create OLE-to-managed target shim // and managed target-to-OLE shims. if (viewAdapter != null) { // Create OLE shim that wraps main controller ICommandTarget and represents // it as IOleCommandTarget that is accepted by VS IDE. oleControllerShim = new CommandTargetToOleShim(textView, controller); IOleCommandTarget nextOleTarget; viewAdapter.AddCommandFilter(oleControllerShim, out nextOleTarget); // nextOleTarget is typically a core editor wrapped into OLE layer. // Create a wrapper that will present OLE target as ICommandTarget to // HTML main controller so controller can operate in platform-agnostic way. ICommandTarget nextCommandTarget = VsAppShell.Current.TranslateCommandTarget(textView, nextOleTarget); controller.ChainedController = nextCommandTarget; } return oleControllerShim; }
public NavigationBarClient( IVsDropdownBarManager manager, IVsCodeWindow codeWindow, IServiceProvider serviceProvider, VisualStudioWorkspaceImpl workspace) { _manager = manager; _codeWindow = codeWindow; _workspace = workspace; _imageService = (IVsImageService2)serviceProvider.GetService(typeof(SVsImageService)); _projectItems = SpecializedCollections.EmptyList<NavigationBarProjectItem>(); _currentTypeItems = SpecializedCollections.EmptyList<NavigationBarItem>(); var vsShell = serviceProvider.GetService(typeof(SVsShell)) as IVsShell; if (vsShell != null) { object varImageList; int hresult = vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_ObjectMgrTypesImgList, out varImageList); if (ErrorHandler.Succeeded(hresult) && varImageList != null) { _imageList = (IntPtr)(int)varImageList; } } _codeWindowEventsSink = ComEventSink.Advise<IVsCodeWindowEvents>(codeWindow, this); _editorAdaptersFactoryService = serviceProvider.GetMefService<IVsEditorAdaptersFactoryService>(); IVsTextView pTextView; codeWindow.GetPrimaryView(out pTextView); StartTrackingView(pTextView); pTextView = null; codeWindow.GetSecondaryView(out pTextView); StartTrackingView(pTextView); }
internal VsInteractiveWindow(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags) { _componentModel = model; this.Caption = title; _editorAdapters = _componentModel.GetService<IVsEditorAdaptersFactoryService>(); _evaluator = evaluator; // The following calls this.OnCreate: Guid clsId = this.ToolClsid; Guid empty = Guid.Empty; Guid typeId = providerId; IVsWindowFrame frame; var vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)); // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are // destroyed when closed. We are really multi instance but we don't want to be closed. ErrorHandler.ThrowOnFailure( vsShell.CreateToolWindow( (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags), (uint)instanceId, this.GetIVsWindowPane(), ref clsId, ref typeId, ref empty, null, title, null, out frame ) ); this.Frame = frame; }
public HostFactory( IVim vim, ITextBufferFactoryService bufferFactoryService, ITextEditorFactoryService editorFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IKeyBindingService keyBindingService, SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService adaptersFactory, IExternalEditorManager externalEditorManager, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, IVsAdapter adapter, IProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory) { _vim = vim; _keyBindingService = keyBindingService; _bufferFactoryService = bufferFactoryService; _editorFactoryService = editorFactoryService; _editorOptionsFactoryService = editorOptionsFactoryService; _externalEditorManager = externalEditorManager; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; }
internal static bool ContainsImmediateWindow(this IEnumerable<IVsTextView> vsTextViews, IVsUIShell shellService, IVsEditorAdaptersFactoryService _editorAdaptersFactoryService) { IEnumWindowFrames windowEnum = null; Marshal.ThrowExceptionForHR(shellService.GetToolWindowEnum(out windowEnum)); IVsWindowFrame[] frame = new IVsWindowFrame[1]; uint value; var immediateWindowGuid = Guid.Parse(ToolWindowGuids80.ImmediateWindow); while (windowEnum.Next(1, frame, out value) == VSConstants.S_OK) { Guid toolWindowGuid; Marshal.ThrowExceptionForHR(frame[0].GetGuidProperty((int)__VSFPROPID.VSFPROPID_GuidPersistenceSlot, out toolWindowGuid)); if (toolWindowGuid == immediateWindowGuid) { IntPtr frameTextView; Marshal.ThrowExceptionForHR(frame[0].QueryViewInterface(typeof(IVsTextView).GUID, out frameTextView)); try { var immediateWindowTextView = Marshal.GetObjectForIUnknown(frameTextView) as IVsTextView; var immediateWindowWpfTextView = _editorAdaptersFactoryService.GetWpfTextView(immediateWindowTextView); return vsTextViews.Any(vsTextView => _editorAdaptersFactoryService.GetWpfTextView(vsTextView) == immediateWindowWpfTextView); } finally { Marshal.Release(frameTextView); } } } return false; }
public AbstractSnippetExpansionClient(Guid languageServiceGuid, ITextView textView, ITextBuffer subjectBuffer, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { this.LanguageServiceGuid = languageServiceGuid; this.TextView = textView; this.SubjectBuffer = subjectBuffer; this.EditorAdaptersFactoryService = editorAdaptersFactoryService; }
public BackgroundColorVisualManager(IWpfTextView view, ITagAggregator<IClassificationTag> aggregator, IClassificationFormatMap formatMap, IVsFontsAndColorsInformationService fcService, IVsEditorAdaptersFactoryService adaptersService) { _view = view; _layer = view.GetAdornmentLayer("BackgroundColorFix"); _aggregator = aggregator; _formatMap = formatMap; _fcService = fcService; _adaptersService = adaptersService; _view.LayoutChanged += OnLayoutChanged; // Here are the hacks for making the normal classification background go away: _formatMap.ClassificationFormatMappingChanged += (sender, args) => { if (!_inUpdate && _view != null && !_view.IsClosed) { _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); } }; _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); }
public TemplateCompletionHandlerProvider( ITemplateEditorOptions options, IVsEditorAdaptersFactoryService editorAdapterFactory, SVsServiceProvider serviceProvider, ICompletionBroker completionBroker) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (editorAdapterFactory == null) { throw new ArgumentNullException(nameof(editorAdapterFactory)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (completionBroker == null) { throw new ArgumentNullException(nameof(completionBroker)); } this.options = options; this.editorAdapterFactory = editorAdapterFactory; this.serviceProvider = serviceProvider; this.completionBroker = completionBroker; }
public XamlTextViewCreationListener( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IVsEditorAdaptersFactoryService adapterService ) { _serviceProvider = serviceProvider; AdapterService = adapterService; }
public PreviewEngine( string title, string helpString, string description, string topLevelItemName, Glyph topLevelGlyph, Solution newSolution, Solution oldSolution, IComponentModel componentModel, IVsImageService2 imageService, bool showCheckBoxes = true) { _topLevelName = topLevelItemName; _topLevelGlyph = topLevelGlyph; _title = title; _helpString = helpString; _description = description; _newSolution = newSolution.WithMergedLinkedFileChangesAsync(oldSolution, cancellationToken: CancellationToken.None).Result; _oldSolution = oldSolution; _diffSelector = componentModel.GetService<ITextDifferencingSelectorService>(); _editorFactory = componentModel.GetService<IVsEditorAdaptersFactoryService>(); _componentModel = componentModel; this.ShowCheckBoxes = showCheckBoxes; _imageService = imageService; }
public ThemeOptionsControl(IThemeAwareDialog child) { InitializeComponent(); Child = child; var control = child as Control; Debug.Assert(Child != null); Debug.Assert(control != null); tableContent.Controls.Add(control); tableContent.SetColumn(control, 0); tableContent.SetRow(control, 1); control.Dock = DockStyle.Fill; var provider = ServiceProvider.GlobalProvider; Service = provider.GetService(typeof(SIndentGuide)) as IndentGuideService; Child.Service = (IIndentGuide)Service; TextManagerService = (IVsTextManager)provider.GetService(typeof(SVsTextManager)); var componentModel = (IComponentModel)provider.GetService(typeof(SComponentModel)); EditorAdapters = (IVsEditorAdaptersFactoryService)componentModel .GetService<IVsEditorAdaptersFactoryService>(); ActiveThemeChanged += ActiveTheme_Changed; }
public ReplWindowTextViewCreationListener(IVsEditorAdaptersFactoryService adaptersFactory, IEditorOperationsFactoryService editorOperationsFactory, [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider, IEditorOptionsFactoryService editorOptionsFactory) { _serviceProvider = serviceProvider; _adaptersFactory = adaptersFactory; _editorOperationsFactory = editorOperationsFactory; _compModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); _editorOptionsFactory = editorOptionsFactory; }
public VsInteractiveWindowCommandFilter(IVsEditorAdaptersFactoryService adapterFactory, IInteractiveWindow window, IVsTextView textViewAdapter, IVsTextBuffer bufferAdapter, IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders, IContentTypeRegistryService contentTypeRegistry) { _window = window; _oleCommandTargetProviders = oleCommandTargetProviders; _contentTypeRegistry = contentTypeRegistry; this.textViewAdapter = textViewAdapter; // make us a code window so we'll have the same colors as a normal code window. IVsTextEditorPropertyContainer propContainer; ErrorHandler.ThrowOnFailure(((IVsTextEditorPropertyCategoryContainer)textViewAdapter).GetPropertyCategory(Microsoft.VisualStudio.Editor.DefGuidList.guidEditPropCategoryViewMasterSettings, out propContainer)); propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewComposite_AllCodeWindowDefaults, true); propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry, true); // editor services are initialized in textViewAdapter.Initialize - hook underneath them: _preEditorCommandFilter = new CommandFilter(this, CommandFilterLayer.PreEditor); ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preEditorCommandFilter, out _editorCommandFilter)); textViewAdapter.Initialize( (IVsTextLines)bufferAdapter, IntPtr.Zero, (uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL | (uint)TextViewInitFlags3.VIF_NO_HWND_SUPPORT, new[] { new INITVIEW { fSelectionMargin = 0, fWidgetMargin = 0, fVirtualSpace = 0, fDragDropMove = 1 } }); // disable change tracking because everything will be changed var textViewHost = adapterFactory.GetWpfTextViewHost(textViewAdapter); _preLanguageCommandFilter = new CommandFilter(this, CommandFilterLayer.PreLanguage); ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preLanguageCommandFilter, out _editorServicesCommandFilter)); _textViewHost = textViewHost; }
public PackageInstallerService( VisualStudioWorkspaceImpl workspace, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _workspace = workspace; _editorAdaptersFactoryService = editorAdaptersFactoryService; }
internal VsVimHost( IVsAdapter adapter, ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, ITextDocumentFactoryService textDocumentFactoryService, ITextBufferUndoManagerProvider undoManagerProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, ISmartIndentationService smartIndentationService, ITextManager textManager, ISharedServiceFactory sharedServiceFactory, IVimApplicationSettings vimApplicationSettings, SVsServiceProvider serviceProvider) : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService) { _vsAdapter = adapter; _editorAdaptersFactoryService = editorAdaptersFactoryService; _dte = (_DTE)serviceProvider.GetService(typeof(_DTE)); _vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility)); _textManager = textManager; _sharedService = sharedServiceFactory.Create(); _vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>(); _fontProperties = new TextEditorFontProperties(serviceProvider); _vimApplicationSettings = vimApplicationSettings; _smartIndentationService = smartIndentationService; uint cookie; _vsMonitorSelection.AdviseSelectionEvents(this, out cookie); }
public VisualStudioDocumentNavigationService( SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _serviceProvider = serviceProvider; _editorAdaptersFactoryService = editorAdaptersFactoryService; }
/// <summary> /// Creates a document provider. /// </summary> /// <param name="projectContainer">Project container for the documents.</param> /// <param name="serviceProvider">Service provider</param> /// <param name="documentTrackingService">An optional <see cref="VisualStudioDocumentTrackingService"/> to track active and visible documents.</param> public DocumentProvider( IVisualStudioHostProjectContainer projectContainer, IServiceProvider serviceProvider, VisualStudioDocumentTrackingService documentTrackingService) { var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); _projectContainer = projectContainer; this._documentTrackingServiceOpt = documentTrackingService; this._runningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable)); this._editorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>(); this._contentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>(); _textUndoHistoryRegistry = componentModel.GetService<ITextUndoHistoryRegistry>(); _textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager)); _fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx)); var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell)); if (shell == null) { // This can happen only in tests, bail out. return; } var runningDocumentTableForEvents = (IVsRunningDocumentTable)_runningDocumentTable; Marshal.ThrowExceptionForHR(runningDocumentTableForEvents.AdviseRunningDocTableEvents(new RunningDocTableEventsSink(this), out _runningDocumentTableEventCookie)); }
public VsTextViewListener( IVsEditorAdaptersFactoryService editorAdaptersFactory, SVsServiceProvider serviceProvider) { this.editorAdaptersFactory = editorAdaptersFactory; this.serviceProvider = serviceProvider; }
internal VsVimHost( IVsAdapter adapter, ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, ITextDocumentFactoryService textDocumentFactoryService, ITextBufferUndoManagerProvider undoManagerProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IWordUtilFactory wordUtilFactory, ITextManager textManager, ISharedServiceFactory sharedServiceFactory, SVsServiceProvider serviceProvider) : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService) { _vsAdapter = adapter; _editorAdaptersFactoryService = editorAdaptersFactoryService; _wordUtilFactory = wordUtilFactory; _dte = (_DTE)serviceProvider.GetService(typeof(_DTE)); _vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility)); _textManager = textManager; _sharedService = sharedServiceFactory.Create(); _vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>(); uint cookie; _vsMonitorSelection.AdviseSelectionEvents(this, out cookie); }
public GoToDefinitionFilterProvider( [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorFactory, IEditorOptionsFactoryService editorOptionsFactory, ITextDocumentFactoryService textDocumentFactoryService, [Import(typeof(DotNetReferenceSourceProvider))] ReferenceSourceProvider referenceSourceProvider, VSLanguageService fsharpVsLanguageService, ProjectFactory projectFactory) { _serviceProvider = serviceProvider; _editorFactory = editorFactory; _editorOptionsFactory = editorOptionsFactory; _textDocumentFactoryService = textDocumentFactoryService; _referenceSourceProvider = referenceSourceProvider; _fsharpVsLanguageService = fsharpVsLanguageService; _projectFactory = projectFactory; var dte = serviceProvider.GetService(typeof(SDTE)) as DTE; var events = dte.Events as Events2; if (events != null) { _solutionEvents = events.SolutionEvents; _solutionEvents.AfterClosing += Cleanup; } }
public HostFactory( IVim vim, IVsEditorAdaptersFactoryService adaptersFactory, IReSharperUtil resharperUtil, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, ITextManager textManager, IVsAdapter adapter, IVimProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IEditorToSettingsSynchronizer editorToSettingSynchronizer) { _vim = vim; _resharperUtil = resharperUtil; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _textManager = textManager; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; _editorToSettingSynchronizer = editorToSettingSynchronizer; #if DEBUG VimTrace.TraceSwitch.Level = TraceLevel.Info; #endif }
public static Result <ITextBuffer> GetTextBuffer(this IVsWindowFrame vsWindowFrame, IVsEditorAdaptersFactoryService factoryService) { var result = GetTextLines(vsWindowFrame); if (result.IsError) { return(Result.CreateError(result.HResult)); } var vsTextLines = result.Value; var textBuffer = factoryService.GetDocumentBuffer(vsTextLines); if (textBuffer == null) { return(Result.Error); } return(Result.CreateSuccess(textBuffer)); }
/// <summary> /// Get the secondary view of the code window. Is actually the one on top /// </summary> public static Result <IWpfTextView> GetSecondaryTextView(this IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService factoryService) { var result = GetSecondaryView(codeWindow); if (result.IsError) { return(Result.CreateError(result.HResult)); } var textView = factoryService.GetWpfTextViewNoThrow(result.Value); return(Result.CreateSuccessNonNull(textView)); }
public GoToDefinitionTextViewCreationListener(SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService, IClassifierAggregatorService classifierAggregatorService, MefProviderOptions mefProviderOptions) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (editorAdaptersFactoryService == null) { throw new ArgumentNullException("editorAdaptersFactoryService"); } if (textStructureNavigatorSelectorService == null) { throw new ArgumentNullException("textStructureNavigatorSelectorService"); } if (classifierAggregatorService == null) { throw new ArgumentNullException("classifierAggregatorService"); } if (mefProviderOptions == null) { throw new ArgumentNullException("mefProviderOptions"); } ServiceProvider = serviceProvider; _editorAdaptersFactoryService = editorAdaptersFactoryService; TextStructureNavigatorSelectorService = textStructureNavigatorSelectorService; ClassifierAggregatorService = classifierAggregatorService; MefProviderOptions = mefProviderOptions; }
public Tuple <System.Windows.Controls.Control, IVsTextView> SetDisplayedFile(string filePath) { //ClearEditor(); try { //Get an invisible editor over the file, this makes it much easier than having to manually figure out the right content type, //language service, and it will automatically associate the document with its owning project, meaning we will get intellisense //in our editor with no extra work. IVsInvisibleEditorManager invisibleEditorManager = (IVsInvisibleEditorManager)GetService(typeof(SVsInvisibleEditorManager)); ErrorHandler.ThrowOnFailure(invisibleEditorManager.RegisterInvisibleEditor(filePath, pProject: null, dwFlags: (uint)_EDITORREGFLAGS.RIEF_ENABLECACHING, pFactory: null, ppEditor: out this.invisibleEditor)); //The doc data is the IVsTextLines that represents the in-memory version of the file we opened in our invisibe editor, we need //to extract that so that we can create our real (visible) editor. IntPtr docDataPointer = IntPtr.Zero; Guid guidIVSTextLines = typeof(IVsTextLines).GUID; ErrorHandler.ThrowOnFailure(this.invisibleEditor.GetDocData(fEnsureWritable: 1, riid: ref guidIVSTextLines, ppDocData: out docDataPointer)); try { IVsTextLines docData = (IVsTextLines)Marshal.GetObjectForIUnknown(docDataPointer); //Get the component model so we can request the editor adapter factory which we can use to spin up an editor instance. IComponentModel componentModel = (IComponentModel)GetService(typeof(SComponentModel)); IVsEditorAdaptersFactoryService editorAdapterFactoryService = componentModel.GetService <IVsEditorAdaptersFactoryService>(); //Create a code window adapter. this.codeWindow = editorAdapterFactoryService.CreateVsCodeWindowAdapter(OleServiceProvider); //Disable the splitter control on the editor as leaving it enabled causes a crash if the user //tries to use it here :( IVsCodeWindowEx codeWindowEx = (IVsCodeWindowEx)this.codeWindow; INITVIEW[] initView = new INITVIEW[1]; codeWindowEx.Initialize((uint)_codewindowbehaviorflags.CWB_DISABLESPLITTER, VSUSERCONTEXTATTRIBUTEUSAGE.VSUC_Usage_Filter, szNameAuxUserContext: "", szValueAuxUserContext: "", InitViewFlags: 0, pInitView: initView); //docData.SetStateFlags((uint)BUFFERSTATEFLAGS.BSF_USER_READONLY); //set read only //Associate our IVsTextLines with our new code window. ErrorHandler.ThrowOnFailure(this.codeWindow.SetBuffer((IVsTextLines)docData)); //Get our text view for our editor which we will use to get the WPF control that hosts said editor. ErrorHandler.ThrowOnFailure(this.codeWindow.GetPrimaryView(out this.textView)); //Get our WPF host from our text view (from our code window). IWpfTextViewHost textViewHost = editorAdapterFactoryService.GetWpfTextViewHost(this.textView); //textViewHost.TextView.Options.SetOptionValue(GitTextViewOptions.DiffMarginId, false); textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.ChangeTrackingId, false); textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false); textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false); textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false); textViewHost.TextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true); return(Tuple.Create <System.Windows.Controls.Control, IVsTextView>(textViewHost.HostControl, this.textView)); //Debug.Assert(contentControl != null); //contentControl.Content = textViewHost.HostControl; } finally { if (docDataPointer != IntPtr.Zero) { //Release the doc data from the invisible editor since it gave us a ref-counted copy. Marshal.Release(docDataPointer); } } } catch { } return(null); }
public InlineRenameUndoManager(InlineRenameService inlineRenameService, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) : base(inlineRenameService) { _editorAdaptersFactoryService = editorAdaptersFactoryService; }
public VsRTextViewConnectionListener(ICoreShell coreShell) : base(coreShell.Services) { _adapterService = coreShell.GetService <IVsEditorAdaptersFactoryService>(); }
public CommandHandlerTextViewCreationListener(SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _serviceProvider = serviceProvider; _editorAdaptersFactoryService = editorAdaptersFactoryService; }
protected DeveroomEditorCommandBroker(IVsEditorAdaptersFactoryService adaptersFactory, [ImportMany] IEnumerable <TCommand> commands) { _adaptersFactory = adaptersFactory; _commands = commands.ToList(); _editorCommandRegistry = new Lazy <Dictionary <DeveroomEditorCommandTargetKey, IDeveroomEditorCommand[]> >(BuildRegistry, LazyThreadSafetyMode.ExecutionAndPublication); }
internal WordAsyncCompletionSession(IAsyncCompletionSession asyncCompletionSession, IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService = null) { _textView = asyncCompletionSession.TextView; _asyncCompletionSession = asyncCompletionSession; _asyncCompletionSession.Dismissed += delegate { OnDismissed(); }; _vsTextView = vsEditorAdaptersFactoryService?.GetViewAdapter(_textView); if (_vsTextView is object) { _tipTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(250), DispatcherPriority.Normal, callback: ResetTipOpacity, Dispatcher.CurrentDispatcher); _tipTimer.Start(); } }
protected override void Initialize() { base.Initialize(); IComponentModel compMod = GetService(typeof(SComponentModel)) as IComponentModel; ITextBufferFactoryService bufferFactory = compMod.GetService <ITextBufferFactoryService>(); ITextEditorFactoryService editorFactory = compMod.GetService <ITextEditorFactoryService>(); IVsEditorAdaptersFactoryService adapterFactory = compMod.GetService <IVsEditorAdaptersFactoryService>(); IContentTypeRegistryService registryService = compMod.GetService <IContentTypeRegistryService>(); completionBroker = compMod.GetService <ICompletionBroker>(); textView = adapterFactory.CreateVsTextViewAdapter(GetService(typeof(IOleServiceProvider)) as IOleServiceProvider); IVsTextBuffer textBuffer = adapterFactory.CreateVsTextBufferAdapter(GetService(typeof(IOleServiceProvider)) as IOleServiceProvider); uint textViewInitFlags = (uint)TextViewInitFlags.VIF_DEFAULT | (uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL; textBuffer.InitializeContent("", 0); textView.Initialize(textBuffer as IVsTextLines, IntPtr.Zero, textViewInitFlags, null); // Create Dev10 objects _textView = adapterFactory.GetWpfTextView(textView); mefTextBuffer = adapterFactory.GetDataBuffer(textBuffer); IVsUserData userData = textView as IVsUserData; if (userData != null) { Guid g = Microsoft.VisualStudio.Editor.DefGuidList.guidIWpfTextViewHost; object obj; int hr = userData.GetData(ref g, out obj); if (hr == VSConstants.S_OK) { _textViewHost = obj as IWpfTextViewHost; } } //Initialize the history history = new HistoryBuffer(); // Create the stream on top of the text buffer. textStream = new TextBufferStream(mefTextBuffer); // Initialize the engine. InitializeEngine(); IContentType ipContentType = registryService.GetContentType(PyContentTypeDefinition.ConsoleContentType); mefTextBuffer.ChangeContentType(ipContentType, null); adapterFactory.GetWpfTextView(textView).Caret.MoveTo(new SnapshotPoint(mefTextBuffer.CurrentSnapshot, mefTextBuffer.CurrentSnapshot.Length)); // Set the title of the window. this.Caption = Resources.ToolWindowTitle; // Set the icon of the toolwindow. this.BitmapResourceID = 301; this.BitmapIndex = 0; return; }
public BreakpointValidationService(IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _editorAdaptersFactoryService = editorAdaptersFactoryService; }
public AbstractSnippetExpansionClient(IThreadingContext threadingContext, Guid languageServiceGuid, ITextView textView, ITextBuffer subjectBuffer, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) : base(threadingContext) { this.LanguageServiceGuid = languageServiceGuid; this.TextView = textView; this.SubjectBuffer = subjectBuffer; this.EditorAdaptersFactoryService = editorAdaptersFactoryService; }
public static Tuple <bool, IWpfTextView> TryGetActiveTextView(this IVsTextManager vsTextManager, IVsEditorAdaptersFactoryService factoryService) { IVsTextView vsTextView; IWpfTextView textView = null; if (ErrorHandler.Succeeded(vsTextManager.GetActiveView(0, null, out vsTextView)) && vsTextView != null) { textView = factoryService.GetWpfTextViewNoThrow(vsTextView); } return(Tuple.Create(textView != null, textView)); }
public TextViewCreationListener(IVsEditorAdaptersFactoryService adaptersFactory) { _adaptersFactory = adaptersFactory; }
public DeveroomCodeEditorCommandBroker(IVsEditorAdaptersFactoryService adaptersFactory, [ImportMany] IEnumerable <IDeveroomCodeEditorCommand> commands) : base(adaptersFactory, commands) { }
public QuickInfoSourceProvider([CanBeNull] IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService) { VsEditorAdaptersFactoryService = vsEditorAdaptersFactoryService; }
public AbstractSnippetCommandHandler(IVsEditorAdaptersFactoryService editorAdaptersFactoryService, SVsServiceProvider serviceProvider) { this.EditorAdaptersFactoryService = editorAdaptersFactoryService; this.ServiceProvider = serviceProvider; }
public UDNDocRunningTableMonitor(IVsRunningDocumentTable rdt, IVsMonitorSelection ms, IVsEditorAdaptersFactoryService eafs, IVsUIShell uiShell, MarkdownPackage package) { this.RunningDocumentTable = rdt; this.MonitorSelection = ms; this.EditorAdaptersFactoryService = eafs; this.UIShell = uiShell; this.package = package; ms.GetCmdUIContextCookie(GuidList.guidMarkdownUIContext, out MarkdownModeUIContextCookie); }
public VsReadOnlyDocumentTracker(IEditAndContinueWorkspaceService encService, IVsEditorAdaptersFactoryService adapters, AbstractProject vsProject) : base(assertIsForeground: true) { Debug.Assert(encService.DebuggingSession != null); _encService = encService; _adapters = adapters; _workspace = encService.DebuggingSession.InitialSolution.Workspace; _vsProject = vsProject; _workspace.DocumentOpened += OnDocumentOpened; UpdateWorkspaceDocuments(); }
public EpochQuickInfoSource(EpochQuickInfoSourceProvider provider, ITextBuffer subjectBuffer, IVsDebugger debugger, IVsEditorAdaptersFactoryService adapter) { m_provider = provider; m_subjectBuffer = subjectBuffer; m_debugger = debugger; m_adapter = adapter; m_parsedProject = subjectBuffer.Properties.GetProperty <Parser.Project>(typeof(Parser.Project)); }
public DartFileChangeTracker(IVsEditorAdaptersFactoryService editorAdaptersFactoryService, DartAnalysisServiceFactory analysisServiceFactory) { this.editorAdaptersFactoryService = editorAdaptersFactoryService; this.analysisService = analysisServiceFactory.GetAnalysisServiceAsync(); }
public SnippetExpansionClient(IThreadingContext threadingContext, Guid languageServiceGuid, ITextView textView, ITextBuffer subjectBuffer, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) : base(threadingContext, languageServiceGuid, textView, subjectBuffer, editorAdaptersFactoryService) { }
public TextViewCreationListener(ICompletionBroker completionBroker, IVsEditorAdaptersFactoryService adaptersFactory, IWorkspaceManager workspaceManager) { _completionBroker = completionBroker; _adaptersFactory = adaptersFactory; _workspaceManager = workspaceManager; }
protected QuickInfoSourceBase([NotNull] IVsEditorAdaptersFactoryService editorAdaptersFactoryService, [NotNull] ITextBuffer textBuffer) { _editorAdaptersFactoryService = editorAdaptersFactoryService; _textBuffer = textBuffer; }
public SnippetCommandHandler(IVsEditorAdaptersFactoryService editorAdaptersFactoryService, SVsServiceProvider serviceProvider) : base(editorAdaptersFactoryService, serviceProvider) { }
protected override IQuickInfoSource CreateQuickInfoSource(IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService, ITextBuffer textBuffer) => new MainQuickInfoSource(vsEditorAdaptersFactoryService, textBuffer);
public VsRunningDocTableEvents(IVsRunningDocumentTable4 runningDocumentTable, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _runningDocumentTable = runningDocumentTable; _editorAdaptersFactoryService = editorAdaptersFactoryService; }
public PackageInstallerService( IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _editorAdaptersFactoryService = editorAdaptersFactoryService; }
public VsReadOnlyDocumentTracker(IThreadingContext threadingContext, IEditAndContinueService encService, IVsEditorAdaptersFactoryService adapters) : base(threadingContext, assertIsForeground: true) { Debug.Assert(encService.DebuggingSession != null); _encService = encService; _adapters = adapters; _workspace = encService.DebuggingSession.InitialSolution.Workspace; _workspace.DocumentOpened += OnDocumentOpened; UpdateWorkspaceDocuments(); }