Пример #1
0
 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;
 }
Пример #2
0
 public EditorTextFactoryService(
         ITextBufferFactoryService textBufferFactoryService,
         IContentTypeRegistryService contentTypeRegistryService)
 {
     _textBufferFactory = textBufferFactoryService;
     _unknownContentType = contentTypeRegistryService.UnknownContentType;
 }
Пример #3
0
        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);
        }
Пример #4
0
        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;
        }
Пример #5
0
        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
        }
Пример #6
0
		FirstUseOptimizationLoader(IThemeClassificationTypeService themeClassificationTypeService, ITextBufferFactoryService textBufferFactoryService, IRoslynDocumentationProviderFactory docFactory, IRoslynDocumentChangedService roslynDocumentChangedService) {
			// This method is currently only called when compiling the code so add an early test
			// that it's still working in case ImmutableArray<T> gets updated.
			ImmutableArrayUtilities<byte>.ToImmutableArray(Array.Empty<byte>());

			new FirstUseOptimization(themeClassificationTypeService, textBufferFactoryService, docFactory, roslynDocumentChangedService);
		}
Пример #7
0
        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);
        }
Пример #8
0
 public MarkdownCodeTest(MarkdownEditorMefCatalogFixture catalogFixture) {
     _exportProvider = catalogFixture.CreateExportProvider();
     _crs = _exportProvider.GetExportedValue<IClassificationTypeRegistryService>();
     _ctrs = _exportProvider.GetExportedValue<IContentTypeRegistryService>();
     _cnp = _exportProvider.GetExports<IClassificationNameProvider, IComponentContentTypes>();
     _tbfs = _exportProvider.GetExportedValue<ITextBufferFactoryService>();
 }
Пример #9
0
        public DocumentProvider(
            IVisualStudioHostProjectContainer projectContainer,
            IServiceProvider serviceProvider,
            bool signUpForFileChangeNotification)
        {
            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));

            _projectContainer = projectContainer;
            this.RunningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable));
            _textBufferFactoryService = componentModel.GetService<ITextBufferFactoryService>();
            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));
            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));
        }
        public SymbolQuickInfoSourceProvider(ITextStructureNavigatorSelectorService navigatorService, 
                                             ITextBufferFactoryService textBufferFactoryService, 
                                             CodeContentControlProvider codeContentControlProvider,
                                             SyntaxQuickinfoBuilderService syntaxQuickinfoBuilderService) {

            SyntaxQuickinfoBuilderService = syntaxQuickinfoBuilderService;
        }
Пример #11
0
        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 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));
        }
Пример #13
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;
 }
Пример #14
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextBufferFactoryService textBufferFactoryService,
     ISharedServiceFactory sharedServiceFactory,
     SVsServiceProvider serviceProvider) : this(adapter, textDocumentFactoryService, textBufferFactoryService, sharedServiceFactory.Create(), serviceProvider)
 {
 }
        public SymbolQuickInfoSourceProvider(ITextStructureNavigatorSelectorService navigatorService, 
                                             ITextBufferFactoryService textBufferFactoryService, 
                                             CodeContentControlProvider codeContentControlProvider, 
                                             IClassificationFormatMapService classificationFormatMapService,
                                             IClassificationTypeRegistryService classificationTypeRegistryService) {

            SyntaxQuickinfoBuilderService = new SyntaxQuickinfoBuilderService(classificationFormatMapService, classificationTypeRegistryService);
        }
Пример #16
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>();
 }
Пример #17
0
 internal VimHostImpl(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService) :
     base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
 {
 }
Пример #18
0
 public ClassifiableDeferredContent(
     IList<SymbolDisplayPart> content,
     ITextBufferFactoryService textBufferFactoryService,
     IContentTypeRegistryService contentTypeRegistryService,
     ClassificationTypeMap typeMap)
 {
     this.ClassifiableContent = content;
     _textBufferFactoryService = textBufferFactoryService;
     _contentTypeRegistryService = contentTypeRegistryService;
     _typeMap = typeMap;
 }
Пример #19
0
		ReplEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename, ITextViewUndoManagerProvider textViewUndoManagerProvider) {
			this.dsTextEditorFactoryService = dsTextEditorFactoryService;
			this.contentTypeRegistryService = contentTypeRegistryService;
			this.textBufferFactoryService = textBufferFactoryService;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
			this.editorOptionsFactoryService = editorOptionsFactoryService;
			this.classificationTypeRegistryService = classificationTypeRegistryService;
			this.themeClassificationTypeService = themeClassificationTypeService;
			this.pickSaveFilename = pickSaveFilename;
			this.textViewUndoManagerProvider = textViewUndoManagerProvider;
		}
Пример #20
0
 protected VimHost(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorOperationsFactoryService = editorOperationsFactoryService;
 }
Пример #21
0
 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 TestContext(string projectLanguage = null, IEnumerable<string> metadataSources = null, bool includeXmlDocComments = false, string sourceWithSymbolReference = null)
            {
                projectLanguage = projectLanguage ?? LanguageNames.CSharp;
                metadataSources = metadataSources ?? SpecializedCollections.EmptyEnumerable<string>();
                metadataSources = !metadataSources.Any()
                    ? new[] { AbstractMetadataAsSourceTests.DefaultMetadataSource }
                    : metadataSources;

                _workspace = CreateWorkspace(projectLanguage, metadataSources, includeXmlDocComments, sourceWithSymbolReference);
                _metadataAsSourceService = _workspace.GetService<IMetadataAsSourceFileService>();
                _textBufferFactoryService = _workspace.GetService<ITextBufferFactoryService>();
            }
Пример #23
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;
        }
Пример #25
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextBufferFactoryService textBufferFactoryService,
     SVsServiceProvider serviceProvider)
 {
     _vsAdapter = adapter;
     _serviceProvider = serviceProvider;
     _textManager = _serviceProvider.GetService<SVsTextManager, IVsTextManager>();
     _textDocumentFactoryService = textDocumentFactoryService;
     _textBufferFactoryService = textBufferFactoryService;
     _table = new RunningDocumentTable(_serviceProvider);
 }
Пример #26
0
		public CodeEditor(CodeEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) {
			options = options?.Clone() ?? new CodeEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = options.TextBuffer;
			if (textBuffer == null)
				textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			TextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
			TextViewHost.TextView.Options.SetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId, true);
		}
Пример #27
0
 public InlineRenameService(
     IWaitIndicator waitIndicator,
     ITextBufferAssociatedViewService textBufferAssociatedViewService,
     ITextBufferFactoryService textBufferFactoryService,
     [ImportMany] IEnumerable<IRefactorNotifyService> refactorNotifyServices,
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> listeners)
 {
     _waitIndicator = waitIndicator;
     _textBufferAssociatedViewService = textBufferAssociatedViewService;
     _textBufferFactoryService = textBufferFactoryService;
     _refactorNotifyServices = refactorNotifyServices;
     _aggregateListener = new AggregateAsynchronousOperationListener(listeners, FeatureAttribute.Rename);
 }
Пример #28
0
        public InlineRenameSession(
            InlineRenameService renameService,
            Workspace workspace,
            SnapshotSpan triggerSpan,
            IInlineRenameInfo renameInfo,
            IWaitIndicator waitIndicator,
            ITextBufferAssociatedViewService textBufferAssociatedViewService,
            ITextBufferFactoryService textBufferFactoryService,
            IEnumerable<IRefactorNotifyService> refactorNotifyServices,
            IAsynchronousOperationListener asyncListener) : base(assertIsForeground: true)
        {
            // This should always be touching a symbol since we verified that upon invocation
            _renameInfo = renameInfo;

            _triggerDocument = triggerSpan.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
            if (_triggerDocument == null)
            {
                throw new InvalidOperationException(EditorFeaturesResources.TheTriggerspanIsNotIncludedInWorkspace);
            }

            _inlineRenameSessionDurationLogBlock = Logger.LogBlock(FunctionId.Rename_InlineSession, CancellationToken.None);

            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _textBufferFactoryService = textBufferFactoryService;
            _textBufferAssociatedViewService = textBufferAssociatedViewService;
            _textBufferAssociatedViewService.SubjectBuffersConnected += OnSubjectBuffersConnected;

            _renameService = renameService;
            _waitIndicator = waitIndicator;
            _refactorNotifyServices = refactorNotifyServices;
            _asyncListener = asyncListener;
            _triggerView = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
                textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First();

            _optionSet = renameInfo.ForceRenameOverloads
                ? workspace.Options.WithChangedOption(RenameOptions.RenameOverloads, true)
                : workspace.Options;

            this.ReplacementText = triggerSpan.GetText();

            _baseSolution = _triggerDocument.Project.Solution;
            this.UndoManager = workspace.Services.GetService<IInlineRenameUndoManager>();

            this._editAndContinueWorkspaceService = workspace.Services.GetService<IEditAndContinueWorkspaceService>();
            this._editAndContinueWorkspaceService.BeforeDebuggingStateChanged += OnBeforeDebuggingStateChanged;

            InitializeOpenBuffers(triggerSpan);
        }
Пример #29
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextBufferFactoryService textBufferFactoryService,
     ISharedService sharedService,
     SVsServiceProvider serviceProvider)
 {
     _vsAdapter = adapter;
     _serviceProvider = serviceProvider;
     _textManager = _serviceProvider.GetService<SVsTextManager, IVsTextManager>();
     _textDocumentFactoryService = textDocumentFactoryService;
     _textBufferFactoryService = textBufferFactoryService;
     _runningDocumentTable = _serviceProvider.GetService<SVsRunningDocumentTable, IVsRunningDocumentTable>();
     _sharedService = sharedService;
 }
            public StandardTextDocument(
                DocumentProvider documentProvider,
                IVisualStudioHostProject project,
                DocumentKey documentKey,
                uint itemId,
                SourceCodeKind sourceCodeKind,
                ITextBufferFactoryService textBufferFactoryService,
                ITextUndoHistoryRegistry textUndoHistoryRegistry,
                IVsFileChangeEx fileChangeService,
                ITextBuffer openTextBuffer,
                DocumentId id)
            {
                Contract.ThrowIfNull(documentProvider);
                Contract.ThrowIfNull(textBufferFactoryService);

                this.Project = project;
                this.Id = id ?? DocumentId.CreateNewId(project.Id, documentKey.Moniker);
                this.Folders = project.GetFolderNames(itemId);

                // TODO: 
                // this one doesn't work for asynchronous project load situation where shared projects is loaded after one uses shared file. 
                // we need to figure out what to do on those case. but this works for project k case.
                // opened an issue to track this issue - https://github.com/dotnet/roslyn/issues/1859
                this.SharedHierarchy = project.Hierarchy == null ? null : LinkedFileUtilities.GetSharedHierarchyForItem(project.Hierarchy, itemId);
                _documentProvider = documentProvider;

                this.Key = documentKey;
                this.SourceCodeKind = sourceCodeKind;
                _itemMoniker = documentKey.Moniker;
                _textBufferFactoryService = textBufferFactoryService;
                _textUndoHistoryRegistry = textUndoHistoryRegistry;
                _fileChangeTracker = new FileChangeTracker(fileChangeService, this.FilePath);
                _fileChangeTracker.UpdatedOnDisk += OnUpdatedOnDisk;

                _openTextBuffer = openTextBuffer;
                _snapshotTracker = new ReiteratedVersionSnapshotTracker(openTextBuffer);

                // The project system does not tell us the CodePage specified in the proj file, so
                // we use null to auto-detect.
                _doNotAccessDirectlyLoader = new FileTextLoader(documentKey.Moniker, defaultEncoding: null);

                // If we aren't already open in the editor, then we should create a file change notification
                if (openTextBuffer == null)
                {
                    _fileChangeTracker.StartFileChangeListeningAsync();
                }
            }
 public InteractiveWindowEditorsFactoryService(ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
 }
 public TextBufferCloneServiceFactory(
     ITextBufferFactoryService textBufferFactoryService,
     IContentTypeRegistryService contentTypeRegistryService)
 {
     _singleton = new TextBufferCloneService((ITextBufferFactoryService3)textBufferFactoryService, contentTypeRegistryService);
 }
Пример #33
0
 LogEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
 {
     this.dsTextEditorFactoryService  = dsTextEditorFactoryService;
     this.contentTypeRegistryService  = contentTypeRegistryService;
     this.textBufferFactoryService    = textBufferFactoryService;
     this.editorOptionsFactoryService = editorOptionsFactoryService;
 }
Пример #34
0
 FirstUseOptimizationLoader(IThemeClassificationTypeService themeClassificationTypeService, ITextBufferFactoryService textBufferFactoryService, IRoslynDocumentationProviderFactory docFactory, IRoslynDocumentChangedService roslynDocumentChangedService)
 {
     new FirstUseOptimization(themeClassificationTypeService, textBufferFactoryService, docFactory, roslynDocumentChangedService);
 }
Пример #35
0
 public VisualStudioSourceTextFactory(ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService)
     : base(textBufferFactoryService, contentTypeRegistryService.GetContentType(ShaderLabConstants.ContentTypeName))
 {
 }
Пример #36
0
 public PreviewChangesService(IWpfDifferenceViewerFactoryService diffFactory, IDifferenceBufferFactoryService diffBufferFactory, ITextBufferFactoryService bufferFactory, ITextEditorFactoryService textEditorFactoryService)
 {
     _diffFactory       = diffFactory;
     _diffBufferFactory = diffBufferFactory;
     _bufferFactory     = bufferFactory;
     _previewRoleSet    = textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable);
 }
Пример #37
0
 EditValueProviderServiceImpl(IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService)
 {
     this.contentTypeRegistryService = contentTypeRegistryService;
     this.textBufferFactoryService   = textBufferFactoryService;
     this.textEditorFactoryService   = textEditorFactoryService;
 }
Пример #38
0
 public static ITextBuffer CreateTextBuffer(this ITextBufferFactoryService textBufferFactoryService, params string[] lines)
 {
     textBufferFactoryService.ThrowOnNull(nameof(textBufferFactoryService));
     return(CreateTextBuffer(textBufferFactoryService, null, lines));
 }
Пример #39
0
 public EditorTextDifferencingService(ITextBufferFactoryService textBufferFactoryService, ITextDifferencingSelectorService differenceSelectorService)
 {
     _textBufferFactoryService  = textBufferFactoryService;
     _differenceSelectorService = differenceSelectorService;
 }
		SignatureHelpPresenterProvider(ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, IClassifierAggregatorService classifierAggregatorService, IClassificationFormatMapService classificationFormatMapService) {
			this.textBufferFactoryService = textBufferFactoryService;
			this.contentTypeRegistryService = contentTypeRegistryService;
			this.classifierAggregatorService = classifierAggregatorService;
			this.classificationFormatMapService = classificationFormatMapService;
		}
Пример #41
0
 DocumentViewerProvider(IWpfCommandManager wpfCommandManager, IMenuManager menuManager, IDocumentViewerServiceImpl documentViewerServiceImpl, ITextBufferFactoryService textBufferFactoryService, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService)
 {
     this.wpfCommandManager             = wpfCommandManager;
     this.menuManager                   = menuManager;
     this.documentViewerServiceImpl     = documentViewerServiceImpl;
     this.textBufferFactoryService      = textBufferFactoryService;
     this.dnSpyTextEditorFactoryService = dnSpyTextEditorFactoryService;
 }
Пример #42
0
        public CodeEditor(CodeEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            options = options?.Clone() ?? new CodeEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = options.TextBuffer;

            if (textBuffer == null)
            {
                textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
            }
            var roles    = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
            var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);

            TextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
            TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.CodeEditor);
            TextViewHost.TextView.Options.SetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId, true);
        }
 public InteractiveWindowEditorsFactoryService(ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, IContentTypeRegistryService contentTypeRegistry)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _contentTypeRegistry      = contentTypeRegistry;
 }
Пример #44
0
 DocumentViewerProvider(IWpfCommandService wpfCommandService, IMenuService menuService, IDocumentViewerServiceImpl documentViewerServiceImpl, ITextBufferFactoryService textBufferFactoryService, IDsTextEditorFactoryService dsTextEditorFactoryService)
 {
     this.wpfCommandService          = wpfCommandService;
     this.menuService                = menuService;
     this.documentViewerServiceImpl  = documentViewerServiceImpl;
     this.textBufferFactoryService   = textBufferFactoryService;
     this.dsTextEditorFactoryService = dsTextEditorFactoryService;
 }
Пример #45
0
        public LogEditor(LogEditorOptions options, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            this.dispatcher       = Dispatcher.CurrentDispatcher;
            this.cachedColorsList = new CachedColorsList();
            options = options?.Clone() ?? new LogEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));

            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = textBufferFactoryService.CreateTextBuffer(contentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var rolesList = new List <string>(defaultRoles);

            rolesList.AddRange(options.ExtraRoles);
            var roles           = dnSpyTextEditorFactoryService.CreateTextViewRoleSet(rolesList);
            var textView        = dnSpyTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
            var wpfTextViewHost = dnSpyTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            this.wpfTextView     = wpfTextViewHost.TextView;
            wpfTextView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStylesConstants.DefaultValue);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
            SetNewDocument();
        }
Пример #46
0
        public MacDebuggerObjectNameView(MacObjectValueTreeView treeView) : base(treeView, "name")
        {
            ImageView = new NSImageView {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            TextField = new MacDebuggerTextField(this)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                LineBreakMode        = NSLineBreakMode.Clipping,
                MaximumNumberOfLines = 1,
                DrawsBackground      = false,
                Bordered             = false,
                Editable             = false
            };

            AddSubview(ImageView);
            AddSubview(TextField);

            AddNewExpressionButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AccessibilityTitle = GettextCatalog.GetString("Add item to watch"),
                Image      = GetImage("gtk-add", Gtk.IconSize.Menu),
                BezelStyle = NSBezelStyle.Inline,
                Bordered   = false
            };
            AddNewExpressionButton.Activated += OnAddNewExpressionButtonClicked;

            PreviewButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AccessibilityTitle = GettextCatalog.GetString("Open Preview Visualizer"),
                Image      = GetImage("md-empty", Gtk.IconSize.Menu),
                BezelStyle = NSBezelStyle.Inline,
                Bordered   = false
            };
            PreviewButton.Activated += OnPreviewButtonClicked;

            var contentTypeRegistry = CompositionManager.Instance.GetExportedValue <IContentTypeRegistryService> ();

            textBufferFactory = CompositionManager.Instance.GetExportedValue <ITextBufferFactoryService> ();
            var factory = CompositionManager.Instance.GetExportedValue <ICocoaTextEditorFactoryService> ();

            contentType = contentTypeRegistry.GetContentType(DebuggerCompletion.ContentType);
            var editorFormatMapService = CompositionManager.Instance.GetExportedValue <IEditorFormatMapService> ();
            var appearanceCategory     = Guid.NewGuid().ToString();
            var editorFormat           = editorFormatMapService.GetEditorFormatMap(appearanceCategory);

            var resourceDictionary = editorFormat.GetProperties("Plain Text");

            resourceDictionary [ClassificationFormatDefinition.TypefaceId]          = TextField.Font;
            resourceDictionary [ClassificationFormatDefinition.FontRenderingSizeId] = TextField.Font.PointSize - 1;
            editorFormat.SetProperties("Plain Text", resourceDictionary);

            var textBuffer = textBufferFactory.CreateTextBuffer("", contentType);

            editor = factory.CreateTextView(textBuffer);
            editor.Options.SetOptionValue(DefaultTextViewOptions.UseVisibleWhitespaceId, false);
            editor.Options.SetOptionValue(DefaultTextViewOptions.AppearanceCategory, appearanceCategory);
            editor.VisualElement.TranslatesAutoresizingMaskIntoConstraints = false;
            editorTextView = new NSView {
                TranslatesAutoresizingMaskIntoConstraints = false, WantsLayer = true
            };
            editorTextView.Layer.BackgroundColor = NSColor.White.CGColor;
            editorTextView.AddSubview(editor.VisualElement);

            editor.VisualElement.TopAnchor.ConstraintEqualToAnchor(editorTextView.TopAnchor).Active       = true;
            editor.VisualElement.LeftAnchor.ConstraintEqualToAnchor(editorTextView.LeftAnchor).Active     = true;
            editor.VisualElement.RightAnchor.ConstraintEqualToAnchor(editorTextView.RightAnchor).Active   = true;
            editor.VisualElement.BottomAnchor.ConstraintEqualToAnchor(editorTextView.BottomAnchor).Active = true;

            editor.LostAggregateFocus += OnEditorLostFocus;
        }
Пример #47
0
 public TextFactoryFactory(
     ITextBufferFactoryService textBufferFactoryService,
     IContentTypeRegistryService contentTypeRegistryService)
 {
     _singleton = new TextBufferTextFactory(textBufferFactoryService, contentTypeRegistryService);
 }
Пример #48
0
 /// <summary>
 /// Create an ITextBuffer with the specified lines
 /// </summary>
 public static ITextBuffer CreateTextBuffer(this ITextBufferFactoryService textBufferFactoryService, params string[] lines)
 {
     return(CreateTextBuffer(textBufferFactoryService, null, lines));
 }
Пример #49
0
        public FirstUseOptimization(IThemeClassificationTypeService themeClassificationTypeService, ITextBufferFactoryService textBufferFactoryService, IRoslynDocumentationProviderFactory docFactory, IRoslynDocumentChangedService roslynDocumentChangedService)
        {
            var buffer = textBufferFactoryService.CreateTextBuffer();
            var tagger = new RoslynTagger(buffer, themeClassificationTypeService, roslynDocumentChangedService);

            Task.Run(() => InitializeAsync(buffer, tagger, docFactory))
            .ContinueWith(t => {
                var ex = t.Exception;
                Debug2.Assert(ex is null);
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
        }
 protected VisualStudioSourceTextFactoryBase(ITextBufferFactoryService textBufferFactoryService, IContentType contentType)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _contentType = contentType;
 }
Пример #51
0
 internal DirectoryUtil(IFileSystem fileSystem, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService)
 {
     _fileSystem = fileSystem;
     _contentTypeRegistryService = contentTypeRegistryService;
     _textBufferFactoryService   = textBufferFactoryService;
 }
Пример #52
0
 ReplEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename)
 {
     this.dsTextEditorFactoryService        = dsTextEditorFactoryService;
     this.contentTypeRegistryService        = contentTypeRegistryService;
     this.textBufferFactoryService          = textBufferFactoryService;
     this.editorOperationsFactoryService    = editorOperationsFactoryService;
     this.editorOptionsFactoryService       = editorOptionsFactoryService;
     this.classificationTypeRegistryService = classificationTypeRegistryService;
     this.themeClassificationTypeService    = themeClassificationTypeService;
     this.pickSaveFilename = pickSaveFilename;
 }
Пример #53
0
 // For unit testing purposes
 internal void Initialize(ITextBufferFactoryService bufferFactoryService)
 {
     Initialize(bufferFactoryService, null);
 }
        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;
                }
            }

            var t = Initialization.Complete;

            //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("text");

            mefTextBuffer.ChangeContentType(ipContentType, null);
            var options = adapterFactory.GetWpfTextView(textView).Options;

            options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);

            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;
        }
Пример #55
0
        FirstUseOptimizationLoader(IThemeClassificationTypeService themeClassificationTypeService, ITextBufferFactoryService textBufferFactoryService, IRoslynDocumentationProviderFactory docFactory, IRoslynDocumentChangedService roslynDocumentChangedService)
        {
            // This method is currently only called when compiling the code so add an early test
            // that it's still working in case ImmutableArray<T> gets updated.
            ImmutableArrayUtilities <byte> .ToImmutableArray(Array.Empty <byte>());

            new FirstUseOptimization(themeClassificationTypeService, textBufferFactoryService, docFactory, roslynDocumentChangedService);
        }
Пример #56
0
 internal void Initialize(ITextBufferFactoryService bufferFactoryService, List <Lazy <IEncodingDetector, IEncodingDetectorMetadata> > detectors)
 {
     _bufferFactoryService       = bufferFactoryService;
     _unorderedEncodingDetectors = detectors ?? new List <Lazy <IEncodingDetector, IEncodingDetectorMetadata> >();
 }
 public VisualStudioSourceTextFactory(ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService)
 {
     _textBufferFactoryService = textBufferFactoryService;
     _contentType = contentTypeRegistryService.GetContentType(HlslConstants.ContentTypeName);
 }
Пример #58
0
        public InlineRenameSession(
            IThreadingContext threadingContext,
            InlineRenameService renameService,
            Workspace workspace,
            SnapshotSpan triggerSpan,
            IInlineRenameInfo renameInfo,
            IWaitIndicator waitIndicator,
            ITextBufferAssociatedViewService textBufferAssociatedViewService,
            ITextBufferFactoryService textBufferFactoryService,
            IFeatureServiceFactory featureServiceFactory,
            IEnumerable <IRefactorNotifyService> refactorNotifyServices,
            IAsynchronousOperationListener asyncListener)
            : base(threadingContext, assertIsForeground: true)
        {
            // This should always be touching a symbol since we verified that upon invocation
            _renameInfo = renameInfo;

            _triggerDocument = triggerSpan.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
            if (_triggerDocument == null)
            {
                throw new InvalidOperationException(EditorFeaturesResources.The_triggerSpan_is_not_included_in_the_given_workspace);
            }

            _inlineRenameSessionDurationLogBlock = Logger.LogBlock(FunctionId.Rename_InlineSession, CancellationToken.None);

            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _textBufferFactoryService        = textBufferFactoryService;
            _textBufferAssociatedViewService = textBufferAssociatedViewService;
            _textBufferAssociatedViewService.SubjectBuffersConnected += OnSubjectBuffersConnected;

            // Disable completion when an inline rename session starts
            _featureService          = featureServiceFactory.GlobalFeatureService;
            _completionDisabledToken = _featureService.Disable(PredefinedEditorFeatureNames.Completion, this);

            _renameService          = renameService;
            _waitIndicator          = waitIndicator;
            _refactorNotifyServices = refactorNotifyServices;
            _asyncListener          = asyncListener;
            _triggerView            = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
                                      textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First();

            _optionSet = renameInfo.ForceRenameOverloads
                ? workspace.Options.WithChangedOption(RenameOptions.RenameOverloads, true)
                : workspace.Options;

            _initialRenameText   = triggerSpan.GetText();
            this.ReplacementText = _initialRenameText;

            _baseSolution    = _triggerDocument.Project.Solution;
            this.UndoManager = workspace.Services.GetService <IInlineRenameUndoManager>();

            _debuggingWorkspaceService = workspace.Services.GetService <IDebuggingWorkspaceService>();
            _debuggingWorkspaceService.BeforeDebuggingStateChanged += OnBeforeDebuggingStateChanged;

            if (_renameInfo is IInlineRenameInfoWithFileRename renameInfoWithFileRename)
            {
                FileRenameInfo = renameInfoWithFileRename.GetFileRenameInfo();
            }
            else
            {
                FileRenameInfo = InlineRenameFileRenameInfo.NotAllowed;
            }

            InitializeOpenBuffers(triggerSpan);
        }
Пример #59
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 replContentType       = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
            var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

            _outputBuffer              = bufferFactory.CreateTextBuffer(replOutputContentType);
            _standardInputBuffer       = bufferFactory.CreateTextBuffer();
            _promptBuffer              = bufferFactory.CreateTextBuffer();
            _secondaryPromptBuffer     = bufferFactory.CreateTextBuffer();
            _standardInputPromptBuffer = bufferFactory.CreateTextBuffer();
            _outputLineBreakBuffer     = 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, 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;
        }
Пример #60
0
 public TestContext(TestWorkspace workspace)
 {
     _workspace = workspace;
     _metadataAsSourceService  = _workspace.GetService <IMetadataAsSourceFileService>();
     _textBufferFactoryService = _workspace.GetService <ITextBufferFactoryService>();
 }