/// <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 EditorTextFactoryService( ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService) { _textBufferFactory = textBufferFactoryService; _unknownContentType = contentTypeRegistryService.UnknownContentType; }
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 static CodeEditorOptions TryCreate(ITextViewOptionsGroup group, IContentTypeRegistryService contentTypeRegistryService, ICodeEditorOptionsDefinitionMetadata md) { if (group == null) throw new ArgumentNullException(nameof(group)); if (contentTypeRegistryService == null) throw new ArgumentNullException(nameof(contentTypeRegistryService)); if (md == null) throw new ArgumentNullException(nameof(md)); if (md.ContentType == null) return null; var contentType = contentTypeRegistryService.GetContentType(md.ContentType); if (contentType == null) return null; if (md.Guid == null) return null; Guid guid; if (!Guid.TryParse(md.Guid, out guid)) return null; if (md.LanguageName == null) return null; return new CodeEditorOptions(group, contentType, guid, md.LanguageName); }
TextViewOptionsGroupService(ISettingsService settingsService, IContentTypeRegistryService contentTypeRegistryService, [ImportMany] IEnumerable<Lazy<ITextViewOptionsGroupNameProvider, ITextViewOptionsGroupNameProviderMetadata>> textViewOptionsGroupNameProviders, [ImportMany] IEnumerable<Lazy<IContentTypeOptionDefinitionProvider, IContentTypeOptionDefinitionProviderMetadata>> contentTypeOptionDefinitionProviders) { nameToGroup = new Dictionary<string, TextViewOptionsGroup>(StringComparer.Ordinal); this.contentTypeRegistryService = contentTypeRegistryService; this.textViewOptionsGroupNameProviders = textViewOptionsGroupNameProviders.OrderBy(a => a.Metadata.Order).ToArray(); this.contentTypeOptionDefinitionProviders = contentTypeOptionDefinitionProviders.OrderBy(a => a.Metadata.Order).ToArray(); optionsStorage = new OptionsStorage(settingsService); }
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 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 InteractiveWindowProvider( IContentTypeRegistryService contentTypeRegistry, ITextBufferFactoryService bufferFactory, IProjectionBufferFactoryService projectionBufferFactory, IEditorOperationsFactoryService editorOperationsFactory, ITextBufferUndoManagerProvider textBufferUndoManagerProvider, ITextEditorFactoryService editorFactory, IRtfBuilderService rtfBuilderService, IIntellisenseSessionStackMapService intellisenseSessionStackMap, ISmartIndentationService smartIndenterService, IInteractiveWindowEditorFactoryService windowFactoryService, IWaitIndicator waitIndicator) { _contentTypeRegistry = contentTypeRegistry; _bufferFactory = bufferFactory; _projectionBufferFactory = projectionBufferFactory; _editorOperationsFactory = editorOperationsFactory; _textBufferUndoManagerProvider = textBufferUndoManagerProvider; _editorFactory = editorFactory; _rtfBuilderService = rtfBuilderService; _intellisenseSessionStackMap = intellisenseSessionStackMap; _smartIndenterService = smartIndenterService; _windowFactoryService = windowFactoryService; _waitIndicator = waitIndicator; }
AboutScreenMenuItem(IDocumentViewerContentFactoryProvider documentViewerContentFactoryProvider, IDocumentTabService documentTabService, IAppWindow appWindow, IExtensionService extensionService, IContentTypeRegistryService contentTypeRegistryService) { this.documentViewerContentFactoryProvider = documentViewerContentFactoryProvider; this.documentTabService = documentTabService; this.appWindow = appWindow; this.extensionService = extensionService; aboutContentType = contentTypeRegistryService.GetContentType(ContentTypes.AboutDnSpy); }
public MarkdownCodeTest(MarkdownEditorMefCatalogFixture catalogFixture) { _exportProvider = catalogFixture.CreateExportProvider(); _crs = _exportProvider.GetExportedValue<IClassificationTypeRegistryService>(); _ctrs = _exportProvider.GetExportedValue<IContentTypeRegistryService>(); _cnp = _exportProvider.GetExports<IClassificationNameProvider, IComponentContentTypes>(); _tbfs = _exportProvider.GetExportedValue<ITextBufferFactoryService>(); }
internal TextStructureNavigatorProvider( ITextStructureNavigatorSelectorService selectorService, IContentTypeRegistryService contentTypeService, IWaitIndicator waitIndicator) : base(selectorService, contentTypeService, waitIndicator) { }
public JadeClassifierProvider(IClassificationTypeRegistryService registryService, ITextBufferFactoryService bufferFact, IContentTypeRegistryService contentTypeService, [ImportMany(typeof(ITaggerProvider))]Lazy<ITaggerProvider, TaggerProviderMetadata>[] taggerProviders, [ImportMany(typeof(IClassifierProvider))]Lazy<IClassifierProvider, IClassifierProviderMetadata>[] classifierProviders) { ClassificationRegistryService = registryService; BufferFactoryService = bufferFact; JsContentType = contentTypeService.GetContentType(NodejsConstants.JavaScript); CssContentType = contentTypeService.GetContentType(NodejsConstants.CSS); var jsTagger = taggerProviders.Where( provider => provider.Metadata.ContentTypes.Contains(NodejsConstants.JavaScript) && provider.Metadata.TagTypes.Any(tagType => tagType.IsSubclassOf(typeof(ClassificationTag))) ).FirstOrDefault(); if (JsTaggerProvider != null) { JsTaggerProvider = jsTagger.Value; } var cssTagger = classifierProviders.Where( provider => provider.Metadata.ContentTypes.Any(x => x.Equals("css", StringComparison.OrdinalIgnoreCase)) ).FirstOrDefault(); if (cssTagger != null) { CssClassifierProvider = cssTagger.Value; } }
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)); }
private Utils() { _dte = (DTE)ServiceProvider.GlobalProvider.GetService(typeof(DTE)); IComponentModel componentModel = (IComponentModel)Package.GetGlobalService( typeof(SComponentModel)); _contentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>(); }
public VsRInteractiveWindowComponentContainerFactory( Lazy<IVsInteractiveWindowFactory> vsInteractiveWindowFactory, IContentTypeRegistryService contentTypeRegistryService, ICoreShell shell) { _vsInteractiveWindowFactoryLazy = vsInteractiveWindowFactory; _contentTypeRegistryService = contentTypeRegistryService; _shell = shell; }
public RHistoryIntegrationTest(RComponentsMefCatalogFixture catalog) { _exportProvider = catalog.CreateExportProvider(); _textBufferFactory = _exportProvider.GetExportedValue<ITextBufferFactoryService>(); _textEditorFactory = _exportProvider.GetExportedValue<ITextEditorFactoryService>(); _workflowProvider = _exportProvider.GetExportedValue<IRInteractiveWorkflowProvider>(); _contentTypeRegistryService = _exportProvider.GetExportedValue<IContentTypeRegistryService>(); _historyVisualComponentContainerFactory = _exportProvider.GetExportedValue<IRHistoryVisualComponentContainerFactory>(); }
public TestInteractiveCommandHandler( IInteractiveWindow interactiveWindow, IContentTypeRegistryService contentTypeRegistryService, IEditorOptionsFactoryService editorOptionsFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService) : base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService) { _interactiveWindow = interactiveWindow; }
public CSharpInteractiveCommandHandler( CSharpVsInteractiveWindowProvider interactiveWindowProvider, IContentTypeRegistryService contentTypeRegistryService, IEditorOptionsFactoryService editorOptionsFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService) : base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService) { _interactiveWindowProvider = interactiveWindowProvider; }
TextBufferFactoryService(IContentTypeRegistryService contentTypeRegistryService) { this.contentTypeRegistryService = contentTypeRegistryService; InertContentType = contentTypeRegistryService.GetContentType(ContentTypes.Inert); PlaintextContentType = contentTypeRegistryService.GetContentType(ContentTypes.PlainText); TextContentType = contentTypeRegistryService.GetContentType(ContentTypes.Text); Debug.Assert(InertContentType != null); Debug.Assert(PlaintextContentType != null); Debug.Assert(TextContentType != null); }
protected AbstractEditorFactory(Package package) { _package = package ?? throw new ArgumentNullException(nameof(package)); _componentModel = (IComponentModel)ServiceProvider.GetService(typeof(SComponentModel)); _editorAdaptersFactoryService = _componentModel.GetService<IVsEditorAdaptersFactoryService>(); _contentTypeRegistryService = _componentModel.GetService<IContentTypeRegistryService>(); _waitIndicator = _componentModel.GetService<IWaitIndicator>(); }
public SendHistoryToSourceCommand(ITextView textView, IRHistoryProvider historyProvider, IRInteractiveWorkflow interactiveWorkflow, IContentTypeRegistryService contentTypeRegistry, IActiveWpfTextViewTracker textViewTracker) : base(textView, RGuidList.RCmdSetGuid, RPackageCommandId.icmdSendHistoryToSource, false) { _textViewTracker = textViewTracker; _interactiveWorkflow = interactiveWorkflow; _history = historyProvider.GetAssociatedRHistory(textView); _contentTypes.Add(contentTypeRegistry.GetContentType(RContentTypeDefinition.ContentType)); _contentTypes.Add(contentTypeRegistry.GetContentType(MdProjectionContentTypeDefinition.ContentType)); }
public MdEditorDocument(ITextBuffer textBuffer, IProjectionBufferFactoryService projectionBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, ICoreShell coreShell) { this.TextBuffer = textBuffer; ServiceManager.AddService(this, TextBuffer, coreShell); _projectionBufferManager = new ProjectionBufferManager(textBuffer, projectionBufferFactoryService, contentTypeRegistryService, coreShell, MdProjectionContentTypeDefinition.ContentType, RContentTypeDefinition.ContentType); ContainedLanguageHandler = _rLanguageHandler = new RLanguageHandler(textBuffer, _projectionBufferManager, coreShell); }
public PythonAnalysisClassifierProvider(IContentTypeRegistryService contentTypeRegistryService, [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider) { _type = contentTypeRegistryService.GetContentType(PythonCoreConstants.ContentType); _serviceProvider = serviceProvider; var options = serviceProvider.GetPythonToolsService()?.AdvancedOptions; if (options != null) { options.Changed += AdvancedOptions_Changed; _colorNames = options.ColorNames; _colorNamesWithAnalysis = options.ColorNamesWithAnalysis; } }
public VsRHistoryCommandFactory(IRHistoryProvider historyProvider, IRInteractiveWorkflowProvider interactiveWorkflowProvider, IContentTypeRegistryService contentTypeRegistry, IActiveWpfTextViewTracker textViewTracker) { _historyProvider = historyProvider; _interactiveWorkflowProvider = interactiveWorkflowProvider; _contentTypeRegistry = contentTypeRegistry; _textViewTracker = textViewTracker; }
DecompileDocumentTabContentFactory(IDsDocumentService documentService, IDocumentTreeNodeDecompiler documentTreeNodeDecompiler, IDecompilerService decompilerService, IDecompilationCache decompilationCache, IMethodAnnotations methodAnnotations, IContentTypeRegistryService contentTypeRegistryService, IDocumentViewerContentFactoryProvider documentViewerContentFactoryProvider, IDocumentWriterService documentWriterService) { DocumentService = documentService; DocumentTreeNodeDecompiler = documentTreeNodeDecompiler; DecompilerService = decompilerService; DecompilationCache = decompilationCache; MethodAnnotations = methodAnnotations; ContentTypeRegistryService = contentTypeRegistryService; DocumentViewerContentFactoryProvider = documentViewerContentFactoryProvider; DocumentWriterService = documentWriterService; }
public VsImmediateWindowProvider( SVsServiceProvider serviceProvider, IVsInteractiveWindowFactory interactiveWindowFactory, IViewClassifierAggregatorService classifierAggregator, IContentTypeRegistryService contentTypeRegistry, VisualStudioWorkspace workspace) { _vsInteractiveWindowFactory = interactiveWindowFactory; _vsDebugger = (IVsDebugger)serviceProvider.GetService(typeof(IVsDebugger)); }
public ClassifiableDeferredContent( IList<SymbolDisplayPart> content, ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, ClassificationTypeMap typeMap) { this.ClassifiableContent = content; _textBufferFactoryService = textBufferFactoryService; _contentTypeRegistryService = contentTypeRegistryService; _typeMap = typeMap; }
public RHistoryProvider(ITextBufferFactoryService textBufferFactory, IContentTypeRegistryService contentTypeRegistryService, IFileSystem fileSystem, IEditorOperationsFactoryService editorOperationsFactory, IRtfBuilderService rtfBuilderService, ITextSearchService2 textSearchService, IRSettings settings) { _textBufferFactory = textBufferFactory; _fileSystem = fileSystem; _editorOperationsFactory = editorOperationsFactory; _rtfBuilderService = rtfBuilderService; _textSearchService = textSearchService; _settings = settings; _rtfBuilderService = rtfBuilderService; _contentType = contentTypeRegistryService.GetContentType(RHistoryContentTypeDefinition.ContentType); _histories = new Dictionary<ITextBuffer, IRHistory>(); }
public CSharpInteractiveCommandHandler( CSharpVsInteractiveWindowProvider interactiveWindowProvider, IContentTypeRegistryService contentTypeRegistryService, IEditorOptionsFactoryService editorOptionsFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IWaitIndicator waitIndicator) : base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService, waitIndicator) { _interactiveWindowProvider = interactiveWindowProvider; _sendToInteractiveSubmissionProvider = new CSharpSendToInteractiveSubmissionProvider(); }
public CSharpVsInteractiveWindowProvider( SVsServiceProvider serviceProvider, IVsInteractiveWindowFactory interactiveWindowFactory, IViewClassifierAggregatorService classifierAggregator, IContentTypeRegistryService contentTypeRegistry, IInteractiveWindowCommandsFactory commandsFactory, [ImportMany]IInteractiveWindowCommand[] commands, VisualStudioWorkspace workspace) : base(serviceProvider, interactiveWindowFactory, classifierAggregator, contentTypeRegistry, commandsFactory, commands, workspace) { }
LogEditorProvider(IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) { this.dnSpyTextEditorFactoryService = dnSpyTextEditorFactoryService; this.contentTypeRegistryService = contentTypeRegistryService; this.textBufferFactoryService = textBufferFactoryService; this.editorOptionsFactoryService = editorOptionsFactoryService; }
public PythonClassifierProvider(IContentTypeRegistryService contentTypeRegistryService, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { _type = contentTypeRegistryService.GetContentType(PythonCoreConstants.ContentType); _serviceProvider = serviceProvider; }
public InteractiveCommandContentTypeLanguageService(IContentTypeRegistryService contentTypeRegistry) => _contentTypeRegistry = contentTypeRegistry;
public VBLspContentTypeLanguageService(IContentTypeRegistryService contentTypeRegistry) { _contentTypeRegistry = contentTypeRegistry; }
TextEditorFactoryService(ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ICommandService commandService, ISmartIndentationService smartIndentationService, [ImportMany] IEnumerable <Lazy <IWpfTextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata> > wpfTextViewCreationListeners, [ImportMany] IEnumerable <Lazy <ITextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata> > textViewCreationListeners, IFormattedTextSourceFactoryService formattedTextSourceFactoryService, IViewClassifierAggregatorService viewClassifierAggregatorService, ITextAndAdornmentSequencerFactoryService textAndAdornmentSequencerFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IAdornmentLayerDefinitionService adornmentLayerDefinitionService, ILineTransformProviderService lineTransformProviderService, IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IMenuService menuService, IEditorOperationsFactoryService editorOperationsFactoryService, ISpaceReservationStackProvider spaceReservationStackProvider, IWpfTextViewConnectionListenerServiceProvider wpfTextViewConnectionListenerServiceProvider, IBufferGraphFactoryService bufferGraphFactoryService, [ImportMany] IEnumerable <Lazy <ITextViewModelProvider, IContentTypeAndTextViewRoleMetadata> > textViewModelProviders, IContentTypeRegistryService contentTypeRegistryService, IThemeService themeService, Lazy <ITextViewUndoManagerProvider> textViewUndoManagerProvider) { this.textBufferFactoryService = textBufferFactoryService; this.editorOptionsFactoryService = editorOptionsFactoryService; this.commandService = commandService; this.smartIndentationService = smartIndentationService; this.wpfTextViewCreationListeners = wpfTextViewCreationListeners.ToArray(); this.textViewCreationListeners = textViewCreationListeners.ToArray(); this.formattedTextSourceFactoryService = formattedTextSourceFactoryService; this.viewClassifierAggregatorService = viewClassifierAggregatorService; this.textAndAdornmentSequencerFactoryService = textAndAdornmentSequencerFactoryService; this.classificationFormatMapService = classificationFormatMapService; this.editorFormatMapService = editorFormatMapService; this.adornmentLayerDefinitionService = adornmentLayerDefinitionService; this.lineTransformProviderService = lineTransformProviderService; this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; this.menuService = menuService; this.editorOperationsFactoryService = editorOperationsFactoryService; this.spaceReservationStackProvider = spaceReservationStackProvider; this.wpfTextViewConnectionListenerServiceProvider = wpfTextViewConnectionListenerServiceProvider; this.bufferGraphFactoryService = bufferGraphFactoryService; this.textViewModelProviders = textViewModelProviders.ToArray(); this.contentTypeRegistryService = contentTypeRegistryService; this.themeService = themeService; this.textViewUndoManagerProvider = textViewUndoManagerProvider; }
SignatureHelpPresenterProvider(ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, IClassifierAggregatorService classifierAggregatorService, IClassificationFormatMapService classificationFormatMapService) { this.textBufferFactoryService = textBufferFactoryService; this.contentTypeRegistryService = contentTypeRegistryService; this.classifierAggregatorService = classifierAggregatorService; this.classificationFormatMapService = classificationFormatMapService; }
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; }
AboutScreenMenuItem(IDocumentViewerContentFactoryProvider documentViewerContentFactoryProvider, IDocumentTabService documentTabService, IAppWindow appWindow, IExtensionService extensionService, IContentTypeRegistryService contentTypeRegistryService) { this.documentViewerContentFactoryProvider = documentViewerContentFactoryProvider; this.documentTabService = documentTabService; this.appWindow = appWindow; this.extensionService = extensionService; aboutContentType = contentTypeRegistryService.GetContentType(ContentTypes.AboutDnSpy); }
public CSharpLspContentTypeLanguageService(IContentTypeRegistryService contentTypeRegistry) => _contentTypeRegistry = contentTypeRegistry;
public NodejsClassifierProvider(IContentTypeRegistryService contentTypeRegistryService) { _type = contentTypeRegistryService.GetContentType(NodejsConstants.Nodejs); }
private static IProjectionBuffer CreateProjectionBuffer( IProjectionBufferFactoryService factoryService, IContentTypeRegistryService registryService, IEditorOptions editorOptions, ITextSnapshot snapshot, string separator, object?suffixOpt, bool trim, params LineSpan[] exposedLineSpans) { var spans = new List <object>(); if (exposedLineSpans.Length > 0) { if (exposedLineSpans[0].Start > 0 && !string.IsNullOrEmpty(separator)) { spans.Add(separator); spans.Add(editorOptions.GetNewLineCharacter()); } var snapshotSpanRanges = CreateSnapshotSpanRanges(snapshot, exposedLineSpans); var indentColumn = trim ? DetermineIndentationColumn(editorOptions, snapshotSpanRanges.Flatten()) : 0; foreach (var snapshotSpanRange in snapshotSpanRanges) { foreach (var snapshotSpan in snapshotSpanRange) { var line = snapshotSpan.Snapshot.GetLineFromPosition(snapshotSpan.Start); var indentPosition = line.GetLineOffsetFromColumn(indentColumn, editorOptions) + line.Start; var mappedSpan = new SnapshotSpan(snapshotSpan.Snapshot, Span.FromBounds(indentPosition, snapshotSpan.End)); var trackingSpan = mappedSpan.CreateTrackingSpan(SpanTrackingMode.EdgeExclusive); spans.Add(trackingSpan); // Add a newline between every line. if (snapshotSpan != snapshotSpanRange.Last()) { spans.Add(editorOptions.GetNewLineCharacter()); } } // Add a separator between every set of lines. if (snapshotSpanRange != snapshotSpanRanges.Last()) { spans.Add(editorOptions.GetNewLineCharacter()); spans.Add(separator); spans.Add(editorOptions.GetNewLineCharacter()); } } if (snapshot.GetLineNumberFromPosition(snapshotSpanRanges.Last().Last().End) < snapshot.LineCount - 1) { spans.Add(editorOptions.GetNewLineCharacter()); spans.Add(separator); } } if (suffixOpt != null) { if (spans.Count >= 0) { if (!separator.Equals(spans.Last())) { spans.Add(editorOptions.GetNewLineCharacter()); spans.Add(separator); } spans.Add(editorOptions.GetNewLineCharacter()); } spans.Add(suffixOpt); } return(factoryService.CreateProjectionBuffer( projectionEditResolver: null, sourceSpans: spans, options: ProjectionBufferOptions.None, contentType: registryService.GetContentType(RoslynPreviewContentType))); }
TextParagraphPropertiesFactoryServiceSelector(IContentTypeRegistryService contentTypeRegistryService, [ImportMany] IEnumerable <Lazy <ITextParagraphPropertiesFactoryService, IContentTypeMetadata> > textParagraphPropertiesFactoryServices) { this.contentTypeRegistryService = contentTypeRegistryService; this.textParagraphPropertiesFactoryServices = textParagraphPropertiesFactoryServices.ToArray(); }
public ProviderSelector(IContentTypeRegistryService contentTypeRegistryService, IEnumerable <Lazy <TProvider, TProviderMetadata> > providers) { this.contentTypeRegistryService = contentTypeRegistryService ?? throw new ArgumentNullException(nameof(contentTypeRegistryService)); dict = new Dictionary <IContentType, Lazy <TProvider, TProviderMetadata>[]>(); this.providers = providers.ToArray(); }
public CompletionTextElementProvider(ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap, IContentTypeRegistryService contentTypeRegistryService) { if (textClassifierAggregatorService == null) { throw new ArgumentNullException(nameof(textClassifierAggregatorService)); } if (classificationFormatMap == null) { throw new ArgumentNullException(nameof(classificationFormatMap)); } if (contentTypeRegistryService == null) { throw new ArgumentNullException(nameof(contentTypeRegistryService)); } this.textClassifierAggregatorService = textClassifierAggregatorService; this.classificationFormatMap = classificationFormatMap; this.contentTypeRegistryService = contentTypeRegistryService; this.toClassifier = new Dictionary <IContentType, ITextClassifier>(); }
protected abstract InteractiveEvaluator CreateInteractiveEvaluator( SVsServiceProvider serviceProvider, IViewClassifierAggregatorService classifierAggregator, IContentTypeRegistryService contentTypeRegistry, VisualStudioWorkspace workspace);
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; }
OutputWindowOptionsService(ITextViewOptionsGroupService textViewOptionsGroupService, IContentTypeRegistryService contentTypeRegistryService) { var group = textViewOptionsGroupService.GetGroup(PredefinedTextViewGroupNames.OutputWindow); group.TextViewOptionChanged += TextViewOptionsGroup_TextViewOptionChanged; Default = new OutputWindowOptions(group, contentTypeRegistryService.GetContentType(ContentTypes.Any)); }
internal Commands(IInteractiveWindow window, string prefix, IEnumerable <IInteractiveWindowCommand> commands, IContentTypeRegistryService contentTypeRegistry = null, IStandardClassificationService classificationRegistry = null) { CommandPrefix = prefix; _window = window; Dictionary <string, IInteractiveWindowCommand> commandsDict = new Dictionary <string, IInteractiveWindowCommand>(); foreach (var command in commands) { int length = 0; foreach (var name in command.Names) { if (commandsDict.ContainsKey(name)) { throw new InvalidOperationException(string.Format(InteractiveWindowResources.DuplicateCommand, string.Join(_commandSeparator, command.Names))); } if (length != 0) { length += _commandSeparator.Length; } // plus the length of `#` for display purpose length += name.Length + 1; commandsDict[name] = command; } if (length == 0) { throw new InvalidOperationException(string.Format(InteractiveWindowResources.MissingCommandName, command.GetType().Name)); } _maxCommandNameLength = Math.Max(_maxCommandNameLength, length); } _commands = commandsDict; _classificationRegistry = classificationRegistry; if (contentTypeRegistry != null) { _commandContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName); } if (window != null) { window.SubmissionBufferAdded += Window_SubmissionBufferAdded; window.Properties[typeof(IInteractiveWindowCommands)] = this; } }
CompletionToolTipProvider(IContentTypeRegistryService contentTypeRegistryService, ITaggedTextElementProviderService taggedTextElementProviderService) { contentType = contentTypeRegistryService.GetContentType(RoslynContentTypes.CompletionToolTipRoslyn); this.taggedTextElementProviderService = taggedTextElementProviderService; }
public TextBufferCloneService(ITextBufferFactoryService3 textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService) { _textBufferFactoryService = textBufferFactoryService; _unknownContentType = contentTypeRegistryService.UnknownContentType; }
public TextBufferCloneServiceFactory( ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistry) { _singleton = new TextBufferCloneService((ITextBufferFactoryService3)textBufferFactoryService, contentTypeRegistry.UnknownContentType); }
SmartIndentationService(IContentTypeRegistryService contentTypeRegistryService, [ImportMany] IEnumerable <Lazy <ISmartIndentProvider, IContentTypeMetadata> > smartIndentProviders) { this.contentTypeRegistryService = contentTypeRegistryService; this.smartIndentProviders = smartIndentProviders.ToArray(); }
ClassifierTaggerProvider(IContentTypeRegistryService contentTypeRegistryService, [ImportMany] IEnumerable <Lazy <IClassifierProvider, INamedContentTypeMetadata> > classifierProviders) { this.contentTypeRegistryService = contentTypeRegistryService; this.classifierProviders = classifierProviders.ToArray(); }
public InteractiveCommandsFactory(IContentTypeRegistryService contentTypeRegistry, IStandardClassificationService classification) { this.contentTypeRegistry = contentTypeRegistry; this.standardClassification = classification; }
EditValueProviderServiceImpl(IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService) { this.contentTypeRegistryService = contentTypeRegistryService; this.textBufferFactoryService = textBufferFactoryService; this.textEditorFactoryService = textEditorFactoryService; }
DocumentViewerOptionsService(ITextViewOptionsGroupService textViewOptionsGroupService, IContentTypeRegistryService contentTypeRegistryService) { var group = textViewOptionsGroupService.GetGroup(PredefinedTextViewGroupNames.DocumentViewer); Default = new DocumentViewerOptions(group, contentTypeRegistryService.GetContentType(ContentTypes.Any)); }
public SendHistoryToSourceCommand(ITextView textView, IRHistoryProvider historyProvider, IRInteractiveWorkflowVisual interactiveWorkflow, IContentTypeRegistryService contentTypeRegistry, IActiveWpfTextViewTracker textViewTracker) : base(textView, RGuidList.RCmdSetGuid, RPackageCommandId.icmdSendHistoryToSource, false) { _textViewTracker = textViewTracker; _interactiveWorkflow = interactiveWorkflow; _history = historyProvider.GetAssociatedRHistory(textView); _contentTypes.Add(contentTypeRegistry.GetContentType(RContentTypeDefinition.ContentType)); _contentTypes.Add(contentTypeRegistry.GetContentType(MdProjectionContentTypeDefinition.ContentType)); }
public InteractiveWindow( IInteractiveWindowEditorFactoryService host, IContentTypeRegistryService contentTypeRegistry, ITextBufferFactoryService bufferFactory, IProjectionBufferFactoryService projectionBufferFactory, IEditorOperationsFactoryService editorOperationsFactory, ITextEditorFactoryService editorFactory, IRtfBuilderService rtfBuilderService, IIntellisenseSessionStackMapService intellisenseSessionStackMap, ISmartIndentationService smartIndenterService, IInteractiveEvaluator evaluator) { if (evaluator == null) { throw new ArgumentNullException(nameof(evaluator)); } _dangerous_uiOnly = new UIThreadOnly(this, host); this.Properties = new PropertyCollection(); _history = new History(); _intellisenseSessionStackMap = intellisenseSessionStackMap; _smartIndenterService = smartIndenterService; var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName); var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName); _outputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType); _standardInputBuffer = bufferFactory.CreateTextBuffer(); _inertType = bufferFactory.InertContentType; var projBuffer = projectionBufferFactory.CreateProjectionBuffer( new EditResolver(this), Array.Empty <object>(), ProjectionBufferOptions.None, replContentType); projBuffer.Properties.AddProperty(typeof(InteractiveWindow), this); _projectionBuffer = projBuffer; _dangerous_uiOnly.AppendNewOutputProjectionBuffer(); // Constructor runs on UI thread. projBuffer.Changed += new EventHandler <TextContentChangedEventArgs>(ProjectionBufferChanged); var roleSet = editorFactory.CreateTextViewRoleSet( PredefinedTextViewRoles.Analyzable, PredefinedTextViewRoles.Editable, PredefinedTextViewRoles.Interactive, PredefinedTextViewRoles.Zoomable, PredefinedInteractiveTextViewRoles.InteractiveTextViewRole); _textView = host.CreateTextView(this, projBuffer, roleSet); _textView.Caret.PositionChanged += CaretPositionChanged; _textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true); _textView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false); _textView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false); _textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false); _textView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.None); _lineBreakString = _textView.Options.GetNewLineCharacter(); _dangerous_uiOnly.EditorOperations = editorOperationsFactory.GetEditorOperations(_textView); // Constructor runs on UI thread. _buffer = new OutputBuffer(this); _outputWriter = new InteractiveWindowWriter(this, spans: null); SortedSpans errorSpans = new SortedSpans(); _errorOutputWriter = new InteractiveWindowWriter(this, errorSpans); OutputClassifierProvider.AttachToBuffer(_outputBuffer, errorSpans); _rtfBuilderService = rtfBuilderService; RequiresUIThread(); evaluator.CurrentWindow = this; _evaluator = evaluator; }
public CSHTMLFilePathToContentTypeProvider( IContentTypeRegistryService contentTypeRegistryService, LSPEditorFeatureDetector lspEditorFeatureDetector) : base(contentTypeRegistryService, lspEditorFeatureDetector) { }
public InteractiveWindowEditorsFactoryService(ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, IContentTypeRegistryService contentTypeRegistry) { _textBufferFactoryService = textBufferFactoryService; _textEditorFactoryService = textEditorFactoryService; _contentTypeRegistry = contentTypeRegistry; }