コード例 #1
0
ファイル: HostFactory.cs プロジェクト: bajtos/VsVim
        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;
        }
コード例 #2
0
 public RoslynBlockContextProvider(
     ITextEditorFactoryService textEditorFactoryService,
     IProjectionBufferFactoryService projectionBufferFactoryService)
 {
     _textEditorFactoryService = textEditorFactoryService;
     _projectionBufferFactoryService = projectionBufferFactoryService;
 }
コード例 #3
0
ファイル: VsVimHost.cs プロジェクト: 0-F/VsVim
        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);
        }
コード例 #4
0
ファイル: HostFactory.cs プロジェクト: nligerakis/VsVim
        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
        }
コード例 #5
0
        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));
        }
コード例 #6
0
ファイル: HostFactory.cs プロジェクト: GunioRobot/VsVim
 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;
 }
コード例 #7
0
ファイル: VsVimHost.cs プロジェクト: honeyhoneywell/VsVim
        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);
        }
コード例 #8
0
 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;
 }
コード例 #9
0
 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>();
 }
コード例 #10
0
ファイル: VimHostTests.cs プロジェクト: Yzzl/VsVim
 internal VimHostImpl(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService) :
     base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
 {
 }
コード例 #11
0
        public RHistoryWindowVisualComponent(ITextBuffer historyTextBuffer, IRHistoryProvider historyProvider, ITextEditorFactoryService textEditorFactory, IVisualComponentContainer<IRHistoryWindowVisualComponent> container) {
            _container = container;
            _history = historyProvider.GetAssociatedRHistory(historyTextBuffer);

            TextView = CreateTextView(historyTextBuffer, textEditorFactory);
            Control = textEditorFactory.CreateTextViewHost(TextView, false).HostControl;
            Controller = ServiceManagerBase.GetService<ICommandTarget>(TextView);

            TextView.Selection.SelectionChanged += TextViewSelectionChanged;
        }
コード例 #12
0
 public AbstractSemanticQuickInfoProvider(
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     IGlyphService glyphService,
     ClassificationTypeMap typeMap)
     : base(projectionBufferFactoryService, editorOptionsFactoryService,
            textEditorFactoryService, glyphService, typeMap)
 {
 }
コード例 #13
0
 public RoslynOutliningRegionTag(
     ITextEditorFactoryService textEditorFactoryService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextSnapshot snapshot,
     BlockSpan blockSpan)
 {
     _state = new BlockTagState(
         textEditorFactoryService, projectionBufferFactoryService,
         editorOptionsFactoryService, snapshot, blockSpan);
 }
コード例 #14
0
ファイル: VimHost.cs プロジェクト: nligerakis/VsVim
 protected VimHost(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorOperationsFactoryService = editorOperationsFactoryService;
 }
コード例 #15
0
 public ElisionBufferDeferredContent(
     SnapshotSpan span,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextEditorFactoryService textEditorFactoryService)
 {
     _span = span;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsFactoryService = editorOptionsFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
 }
コード例 #16
0
 public SemanticQuickInfoProvider(
     ITextBufferFactoryService textBufferFactoryService,
     IContentTypeRegistryService contentTypeRegistryService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     IGlyphService glyphService,
     ClassificationTypeMap typeMap)
     : base(textBufferFactoryService, contentTypeRegistryService, projectionBufferFactoryService,
            editorOptionsFactoryService, textEditorFactoryService, glyphService, typeMap)
 {
 }
        public CodeContentControlProvider(ITextEditorFactoryService textEditorFactory, 
                                          IProjectionBufferFactoryService projectionFactory, 
                                          TextViewConnectionListener textViewConnectionListener, 
                                          ITextBufferFactoryService textBufferFactoryService, 
                                          ITextEditorFactoryService textEditorFactoryService) {

            _textEditorFactory          = textEditorFactory;
            _projectionFactory          = projectionFactory;
            _textViewConnectionListener = textViewConnectionListener;
            _textBufferFactoryService   = textBufferFactoryService;
            _textEditorFactoryService   = textEditorFactoryService;
        }
コード例 #18
0
        public MyToolWindow()
            : base(null)
        {
            this.Caption = Resources.ToolWindowTitle;
            this.BitmapResourceID = 301;
            this.BitmapIndex = 1;

            _componentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel));
            _invisibleEditorManager = (IVsInvisibleEditorManager)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsInvisibleEditorManager));
            _editorAdapter = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
            _editorFactoryService = _componentModel.GetService<ITextEditorFactoryService>();
        }
コード例 #19
0
        public VisualStudioSymbolNavigationService(
            SVsServiceProvider serviceProvider,
            VisualStudio14StructureTaggerProvider outliningTaggerProvider)
        {
            _serviceProvider = serviceProvider;
            _outliningTaggerProvider = outliningTaggerProvider;

            var componentModel = _serviceProvider.GetService<SComponentModel, IComponentModel>();
            _editorAdaptersFactory = componentModel.GetService<IVsEditorAdaptersFactoryService>();
            _textEditorFactoryService = componentModel.GetService<ITextEditorFactoryService>();
            _textDocumentFactoryService = componentModel.GetService<ITextDocumentFactoryService>();
            _metadataAsSourceFileService = componentModel.GetService<IMetadataAsSourceFileService>();
        }
コード例 #20
0
ファイル: HostFactory.cs プロジェクト: ameent/VsVim
 public HostFactory(
     IVsVimFactoryService factory,
     IVimBufferFactory vimBufferFactory,
     IVim vim,
     ITextEditorFactoryService editorFactoryService,
     KeyBindingService keyBindingService)
 {
     _vim = vim;
     _vsVimFactory = factory;
     _vimBufferFactory = vimBufferFactory;
     _keyBindingService = keyBindingService;
     _editorFactoryService = editorFactoryService;
 }
コード例 #21
0
 protected AbstractQuickInfoProvider(
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     IGlyphService glyphService,
     ClassificationTypeMap typeMap)
 {
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsFactoryService = editorOptionsFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _glyphService = glyphService;
     _typeMap = typeMap;
 }
コード例 #22
0
        public RoslynOutliningRegionTag(
            ITextEditorFactoryService textEditorFactoryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextSnapshot snapshot,
            BlockSpan outliningSpan)
        {
            _textEditorFactoryService = textEditorFactoryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _subjectBuffer = snapshot.TextBuffer;
            BlockSpan = outliningSpan;

            _hintSpan = snapshot.CreateTrackingSpan(BlockSpan.HintSpan.ToSpan(), SpanTrackingMode.EdgeExclusive);
        }
コード例 #23
0
 public ElisionBufferDeferredContent(
     SnapshotSpan span,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     IContentType contentType = null,
     ITextViewRoleSet roleSet = null)
 {
     _span = span;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsFactoryService = editorOptionsFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _contentType = contentType;
     _roleSet = roleSet ?? _textEditorFactoryService.NoRoles;
 }
コード例 #24
0
 private static IWpfTextView CreateTextView(ITextBuffer historyTextBuffer, ITextEditorFactoryService textEditorFactory) {
     var textView = textEditorFactory.CreateTextView(historyTextBuffer, textEditorFactory.DefaultRoles.UnionWith(textEditorFactory.CreateTextViewRoleSet(TextViewRole)));
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.VerticalScrollBarId, true);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.SelectionMarginId, false);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.ZoomControlId, false);
     textView.Options.SetOptionValue(DefaultWpfViewOptions.EnableMouseWheelZoomId, false);
     textView.Options.SetOptionValue(DefaultWpfViewOptions.EnableHighlightCurrentLineId, false);
     textView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
     textView.Options.SetOptionValue(DefaultTextViewOptions.BraceCompletionEnabledOptionId, false);
     textView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
     textView.Options.SetOptionValue(DefaultTextViewOptions.UseVirtualSpaceId, false);
     textView.Caret.IsHidden = true;
     return textView;
 }
コード例 #25
0
        internal static IWpfTextView CreateShrunkenTextView(
            ITextEditorFactoryService textEditorFactoryService,
            ITextBuffer finalBuffer)
        {
            var roles = textEditorFactoryService.CreateTextViewRoleSet(OutliningRegionTextViewRole);
            var view = textEditorFactoryService.CreateTextView(finalBuffer, roles);

            view.Background = Brushes.Transparent;

            view.SizeToFit();

            // Zoom out a bit to shrink the text.
            view.ZoomLevel *= 0.75;

            return view;
        }
コード例 #26
0
        public InteractiveSmartIndenterProvider(
            ITextEditorFactoryService editorFactory,
            [ImportMany] IEnumerable<Lazy<ISmartIndentProvider, ContentTypeMetadata>> indentProviders)
        {
            if (editorFactory == null)
            {
                throw new ArgumentNullException("editorFactory");
            }

            if (indentProviders == null)
            {
                throw new ArgumentNullException("indentProviders");
            }

            this.editorFactory = editorFactory;
            this.indentProviders = indentProviders;
        }
コード例 #27
0
ファイル: HostFactory.cs プロジェクト: ChrisMarinos/VsVim
 public HostFactory(
     IVim vim,
     ITextEditorFactoryService editorFactoryService,
     IKeyBindingService keyBindingService,
     SVsServiceProvider serviceProvider,
     IVsEditorAdaptersFactoryService adaptersFactory,
     IVimHost host,
     IFileSystem fileSystem)
 {
     _vim = vim;
     _keyBindingService = keyBindingService;
     _editorFactoryService = editorFactoryService;
     _serviceProvider = serviceProvider;
     _adaptersFactory = adaptersFactory;
     _host = host;
     _fileSystem = fileSystem;
 }
コード例 #28
0
ファイル: EditorFactory.cs プロジェクト: jaredpar/VsSamples
 internal EditorFactory(
     SVsServiceProvider vsServiceProvider,
     IVsEditorAdaptersFactoryService vsEditorAdaptersAdapterFactory,
     ITextBufferFactoryService textBufferFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     [EditorUtilsImport] IProtectedOperations protectedOperations)
 {
     _vsEditorFactory = new VsEditorFactory();
     _vsServiceProvider = vsServiceProvider;
     _vsEditorAdaptersFactoryService = vsEditorAdaptersAdapterFactory;
     _textBufferFactoryService = textBufferFactoryService;
     _textDocumentFactoryService = textDocumentFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _oleServiceProvider = _vsServiceProvider.GetService<IOleServiceProvider, IOleServiceProvider>();
     _protectedOperations = protectedOperations;
 }
コード例 #29
0
ファイル: VimAppHost.cs プロジェクト: aesire/VsVim
 internal VimAppHost(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     IContentTypeRegistryService contentTypeRegistryService,
     IFileSystem fileSystem,
     IDirectoryUtil directoryUtil) : base(
     textBufferFactoryService,
     textEditorFactoryService,
     textDocumentFactoryService,
     editorOperationsFactoryService)
 {
     _contentTypeRegistryService = contentTypeRegistryService;
     _fileSystem = fileSystem;
     _directoryUtil = directoryUtil;
 }
コード例 #30
0
 public Tag(
     ITextBuffer subjectBuffer,
     string replacementString,
     SnapshotSpan hintSpan,
     bool isImplementation,
     ITextEditorFactoryService textEditorFactoryService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService)
 {
     _subjectBuffer = subjectBuffer;
     this.CollapsedForm = replacementString;
     _hintSpan = hintSpan.Snapshot.CreateTrackingSpan(hintSpan.Span, SpanTrackingMode.EdgeExclusive);
     this.IsImplementation = isImplementation;
     this.IsDefaultCollapsed = false;
     _textEditorFactoryService = textEditorFactoryService;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsFactoryService = editorOptionsFactoryService;
 }
コード例 #31
0
        public RHistoryWindowVisualComponent(ITextBuffer historyTextBuffer, IRHistoryProvider historyProvider, ITextEditorFactoryService textEditorFactory, IVisualComponentContainer <IRHistoryWindowVisualComponent> container)
        {
            _container = container;
            _history   = historyProvider.GetAssociatedRHistory(historyTextBuffer);

            TextView   = CreateTextView(historyTextBuffer, textEditorFactory);
            Control    = textEditorFactory.CreateTextViewHost(TextView, false).HostControl;
            Controller = ServiceManagerBase.GetService <ICommandTarget>(TextView);

            TextView.Selection.SelectionChanged += TextViewSelectionChanged;
        }
コード例 #32
0
        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 textContentType       = contentTypeRegistry.GetContentType("text");
            var replContentType       = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
            var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

            _outputBuffer        = bufferFactory.CreateTextBuffer(replOutputContentType);
            _standardInputBuffer = bufferFactory.CreateTextBuffer();

            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, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.WordWrap);

            _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;
        }
コード例 #33
0
        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;
        }
コード例 #34
0
        public BufferBar(ITextBuffer textBuffer, IWpfTextViewHost textViewHost, IEditorOperations editorOperations, ITextEditorFactoryService factory)
        {
            InitializeComponent();
            DataContext       = this;
            this.textBuffer   = textBuffer;
            this.projBuffer   = textBuffer as IProjectionBuffer;
            this.elBuffer     = textBuffer as IElisionBuffer;
            this.prevVersion  = textBuffer.CurrentSnapshot.Version;
            this.textView     = textViewHost.TextView;
            this.textViewHost = textViewHost;

            this.factory          = factory;
            this.editorOperations = editorOperations;
            this.snapshots.Add(new WeakReference(textBuffer.CurrentSnapshot));

            SolidColorBrush brush = new SolidColorBrush(textBuffer is IElisionBuffer ? Colors.LightBlue : (textBuffer is IProjectionBuffer ? Colors.LightGreen : Colors.LightGray));

            brush.Freeze();
            //Background = brush;

            ITextDataModel tdm = this.textView.TextDataModel;
            ITextViewModel tvm = this.textView.TextViewModel;

            StringBuilder tip = new StringBuilder();

            if (textBuffer == tdm.DocumentBuffer)
            {
                tip.Append("Document Buffer,");
            }
            if (textBuffer == tdm.DataBuffer)
            {
                tip.Append("Data Buffer,");
            }
            if (textBuffer == tvm.EditBuffer)
            {
                tip.Append("Edit Buffer,");
            }
            if (textBuffer == tvm.VisualBuffer)
            {
                tip.Append("Visual Buffer,");
            }
            if (tip.Length > 0)
            {
                tip.Remove(tip.Length - 1, 1);
                TipText = tip.ToString();
            }
            else
            {
                TipText = "Uncategorized Buffer";
            }

            if (this.projBuffer != null || this.elBuffer != null)
            {
                if (this.projBuffer != null)
                {
                    this.projBuffer.SourceSpansChanged += OnProjectionSourceSpansChanged;
                }
                else
                {
                    this.elBuffer.SourceSpansChanged += OnElisionSourceSpansChanged;
                }
            }
            else
            {
                this.SpansLabel.Visibility = Visibility.Collapsed;
            }

            if (this.textBuffer.Properties.TryGetProperty <ITextDocument>(typeof(ITextDocument), out this.document))
            {
                UpdateEncoding();
                this.document.EncodingChanged += OnEncodingChanged;
            }
            else
            {
                this.EncodingLabel.Visibility = Visibility.Collapsed;
            }

            this.textBuffer.ContentTypeChanged       += OnContentTypeChanged;
            this.textBuffer.Changed                  += OnTextChanged;
            this.textView.Caret.PositionChanged      += OnCaretPositionChanged;
            this.textView.Selection.SelectionChanged += OnSelectionChanged;

            this.SelectionLabel.Background  = Brushes.Transparent;
            this.SelectionLabel.BorderBrush = Brushes.Transparent;
            this.SelectionLabel.Padding     = new Thickness(3.0);
            this.SelectionCombo.Background  = Brushes.Transparent;
            this.SelectionCombo.BorderBrush = Brushes.Transparent;
            this.SelectionCombo.Padding     = new Thickness(3.0);
            this.SelectionPanel.Children.Add(this.SelectionLabel);
            this.selectionLabelInstalled = true;

            UpdateAll();
        }
コード例 #35
0
 public InteractiveWindowEditorsFactoryService(ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, IContentTypeRegistryService contentTypeRegistry)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _contentTypeRegistry      = contentTypeRegistry;
 }
コード例 #36
0
 public static DisposableTextView CreateDisposableTextView(this ITextEditorFactoryService textEditorFactory)
 {
     return(new DisposableTextView(textEditorFactory.CreateTextView()));
 }
コード例 #37
0
 public PreviewChangesService(IWpfDifferenceViewerFactoryService diffFactory, IDifferenceBufferFactoryService diffBufferFactory, ITextBufferFactoryService bufferFactory, ITextEditorFactoryService textEditorFactoryService)
 {
     _diffFactory       = diffFactory;
     _diffBufferFactory = diffBufferFactory;
     _bufferFactory     = bufferFactory;
     _previewRoleSet    = textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable);
 }
コード例 #38
0
 public WpfDifferenceViewElementFactory(IWpfDifferenceViewerFactoryService diffFactory, ITextEditorFactoryService textEditorFactoryService)
 {
     _diffFactory    = diffFactory;
     _previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable);
 }
コード例 #39
0
 public MarginFactory(ITextEditorFactoryService textEditorFactory)
 {
     _textEditorFactory = textEditorFactory;
 }
コード例 #40
0
 public InteractiveWindowEditorsFactoryService(ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
 }
コード例 #41
0
 TextViewOptionsGroupServiceLoader(Lazy <ITextViewOptionsGroupServiceImpl> textViewOptionsGroupService, ITextEditorFactoryService textEditorFactoryService)
 {
     this.textViewOptionsGroupService          = textViewOptionsGroupService;
     textEditorFactoryService.TextViewCreated += TextEditorFactoryService_TextViewCreated;
 }
コード例 #42
0
 public VsRHistoryVisualComponentContainerFactory(ITextEditorFactoryService textEditorFactory, IRHistoryProvider historyProvider)
 {
     _textEditorFactory = textEditorFactory;
     _historyProvider   = historyProvider;
 }
コード例 #43
0
 public EditValueProviderImpl(IContentType contentType, ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, string[] extraTextViewRoles)
 {
     this.contentType = contentType ?? throw new ArgumentNullException(nameof(contentType));
     this.textBufferFactoryService = textBufferFactoryService ?? throw new ArgumentNullException(nameof(textBufferFactoryService));
     this.textEditorFactoryService = textEditorFactoryService ?? throw new ArgumentNullException(nameof(textEditorFactoryService));
     this.extraTextViewRoles       = extraTextViewRoles ?? throw new ArgumentNullException(nameof(extraTextViewRoles));
 }
コード例 #44
0
 EditValueProviderServiceImpl(IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService)
 {
     this.contentTypeRegistryService = contentTypeRegistryService;
     this.textBufferFactoryService   = textBufferFactoryService;
     this.textEditorFactoryService   = textEditorFactoryService;
 }
コード例 #45
0
        public HistoryWindowPane(ITextBuffer historyTextBuffer, IRHistoryProvider historyProvider, ITextEditorFactoryService textEditorFactory)
        {
            _historyTextBuffer = historyTextBuffer;
            _historyProvider   = historyProvider;
            _textEditorFactory = textEditorFactory;

            Caption = Resources.HistoryWindowCaption;
            ToolBar = new CommandID(RGuidList.RCmdSetGuid, RPackageCommandId.historyWindowToolBarId);
        }