Beispiel #1
0
            public TagComputer(
                ITextBuffer subjectBuffer,
                IForegroundNotificationService notificationService,
                IAsynchronousOperationListener asyncListener,
                ClassificationTypeMap typeMap,
                SyntacticClassificationTaggerProvider taggerProvider,
                IViewSupportsClassificationService viewSupportsClassificationServiceOpt,
                ITextBufferAssociatedViewService associatedViewService,
                IEditorClassificationService editorClassificationService,
                string languageName)
            {
                _subjectBuffer       = subjectBuffer;
                _notificationService = notificationService;
                _listener            = asyncListener;
                _typeMap             = typeMap;
                _taggerProvider      = taggerProvider;
                _viewSupportsClassificationServiceOpt = viewSupportsClassificationServiceOpt;
                _associatedViewService       = associatedViewService;
                _editorClassificationService = editorClassificationService;
                _languageName = languageName;

                _workQueue = new AsynchronousSerialWorkQueue(asyncListener);
                _reportChangeCancellationSource = new CancellationTokenSource();

                _lastLineCache = new LastLineCache();

                _workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
                _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;

                ConnectToWorkspace(_workspaceRegistration.Workspace);
            }
 public ViewSupportsClassificationService(
     ITextBufferAssociatedViewService viewService,
     IVsEditorAdaptersFactoryService editorAdaptersFactoryService, 
     SVsServiceProvider serviceProvider)
 {
     _editorAdaptersFactoryService = editorAdaptersFactoryService;
     _serviceProvider = serviceProvider;
 }
Beispiel #3
0
 public ViewSupportsClassificationService(
     ITextBufferAssociatedViewService viewService,
     IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
     SVsServiceProvider serviceProvider)
 {
     _editorAdaptersFactoryService = editorAdaptersFactoryService;
     _serviceProvider = serviceProvider;
 }
Beispiel #4
0
            public CaretPositionRestorer(ITextBuffer subjectBuffer, ITextBufferAssociatedViewService visibilityService)
            {
                Contract.ThrowIfNull(visibilityService);
                _subjectBuffer = subjectBuffer;
                _caretPositionChangedHandler = (s, e) => _caretChanged = true;
                _visibilityService           = visibilityService;

                _caretPositions = GetCaretPositions();
            }
Beispiel #5
0
 public CodeActionEditHandlerService(
     IPreviewFactoryService previewService,
     IInlineRenameService renameService,
     ITextBufferAssociatedViewService associatedViewService)
 {
     _previewService        = previewService;
     _renameService         = renameService;
     _associatedViewService = associatedViewService;
 }
 public CodeActionEditHandlerService(
     IPreviewFactoryService previewService,
     IInlineRenameService renameService,
     ITextBufferAssociatedViewService associatedViewService)
 {
     _previewService = previewService;
     _renameService = renameService;
     _associatedViewService = associatedViewService;
 }
Beispiel #7
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;

            this.ReplacementText = triggerSpan.GetText();

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

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

            InitializeOpenBuffers(triggerSpan);
        }
            public CaretPositionRestorer(ITextBuffer subjectBuffer, ITextBufferAssociatedViewService visibilityService)
            {
                Contract.ThrowIfNull(visibilityService);
                _subjectBuffer = subjectBuffer;
                _caretPositionChangedHandler = (s, e) => _caretChanged = true;
                _visibilityService = visibilityService;

                _caretPositions = GetCaretPositions();
            }
Beispiel #9
0
 public CodeActionEditHandlerService(
     IThreadingContext threadingContext,
     IPreviewFactoryService previewService,
     IInlineRenameService renameService,
     ITextBufferAssociatedViewService associatedViewService)
     : base(threadingContext)
 {
     _previewService        = previewService;
     _renameService         = renameService;
     _associatedViewService = associatedViewService;
 }
Beispiel #10
0
 public InlineRenameService(
     IWaitIndicator waitIndicator,
     ITextBufferAssociatedViewService textBufferAssociatedViewService,
     ITextBufferFactoryService textBufferFactoryService,
     [ImportMany] IEnumerable <IRefactorNotifyService> refactorNotifyServices,
     IAsynchronousOperationListenerProvider listenerProvider)
 {
     _waitIndicator = waitIndicator;
     _textBufferAssociatedViewService = textBufferAssociatedViewService;
     _textBufferFactoryService        = textBufferFactoryService;
     _refactorNotifyServices          = refactorNotifyServices;
     _asyncListener = listenerProvider.GetListener(FeatureAttribute.Rename);
 }
Beispiel #11
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);
 }
Beispiel #12
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);
 }
        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);
        }
Beispiel #14
0
 public InlineRenameService(
     IThreadingContext threadingContext,
     IUIThreadOperationExecutor uiThreadOperationExecutor,
     ITextBufferAssociatedViewService textBufferAssociatedViewService,
     ITextBufferFactoryService textBufferFactoryService,
     IFeatureServiceFactory featureServiceFactory,
     [ImportMany] IEnumerable <IRefactorNotifyService> refactorNotifyServices,
     IAsynchronousOperationListenerProvider listenerProvider)
 {
     _threadingContext                = threadingContext;
     _uiThreadOperationExecutor       = uiThreadOperationExecutor;
     _textBufferAssociatedViewService = textBufferAssociatedViewService;
     _textBufferFactoryService        = textBufferFactoryService;
     _featureServiceFactory           = featureServiceFactory;
     _refactorNotifyServices          = refactorNotifyServices;
     _asyncListener = listenerProvider.GetListener(FeatureAttribute.Rename);
 }
 public SyntacticClassificationTaggerProvider(
     IForegroundNotificationService notificationService,
     ClassificationTypeMap typeMap,
     [Import(AllowDefault = true)] IViewSupportsClassificationService viewSupportsClassificationServiceOpt,
     ITextBufferAssociatedViewService associatedViewService,
     [ImportMany] IEnumerable <Lazy <ILanguageService, LanguageServiceMetadata> > allLanguageServices,
     [ImportMany] IEnumerable <Lazy <ILanguageService, ContentTypeLanguageMetadata> > contentTypes,
     [ImportMany] IEnumerable <Lazy <IAsynchronousOperationListener, FeatureMetadata> > asyncListeners)
 {
     _notificationService = notificationService;
     _typeMap             = typeMap;
     _viewSupportsClassificationServiceOpt = viewSupportsClassificationServiceOpt;
     _associatedViewService = associatedViewService;
     _editorClassificationLanguageServices = allLanguageServices.Where(s => s.Metadata.ServiceType == typeof(IEditorClassificationService).AssemblyQualifiedName);
     _contentTypesToLanguageNames          = contentTypes.Where(x => x.Metadata.DefaultContentType != null);
     _asyncListeners = asyncListeners;
 }
Beispiel #16
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 = workspace.Options;

            this.ReplacementText = triggerSpan.GetText();

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

            InitializeOpenBuffers(triggerSpan);
        }
Beispiel #17
0
        public InlineRenameSession(
            IThreadingContext threadingContext,
            InlineRenameService renameService,
            Workspace workspace,
            SnapshotSpan triggerSpan,
            IInlineRenameInfo renameInfo,
            SymbolRenameOptions options,
            bool previewChanges,
            IUIThreadOperationExecutor uiThreadOperationExecutor,
            ITextBufferAssociatedViewService textBufferAssociatedViewService,
            ITextBufferFactoryService textBufferFactoryService,
            IFeatureServiceFactory featureServiceFactory,
            IEnumerable <IRefactorNotifyService> refactorNotifyServices,
            IAsynchronousOperationListener asyncListener)
        {
            // This should always be touching a symbol since we verified that upon invocation
            _threadingContext = threadingContext;
            _renameInfo       = renameInfo;

            _triggerSpan     = triggerSpan;
            _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;
            _uiThreadOperationExecutor = uiThreadOperationExecutor;
            _refactorNotifyServices    = refactorNotifyServices;
            _asyncListener             = asyncListener;
            _triggerView = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
                           textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First();

            _options        = options;
            _previewChanges = previewChanges;

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

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

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

            InitializeOpenBuffers(triggerSpan);
        }
            public TagComputer(
                ITextBuffer subjectBuffer,
                IForegroundNotificationService notificationService,
                IAsynchronousOperationListener asyncListener,
                ClassificationTypeMap typeMap,
                SyntacticClassificationTaggerProvider taggerProvider,
                IViewSupportsClassificationService viewSupportsClassificationServiceOpt,
                ITextBufferAssociatedViewService associatedViewService,
                IEditorClassificationService editorClassificationService,
                string languageName)
            {
                _subjectBuffer = subjectBuffer;
                _notificationService = notificationService;
                _listener = asyncListener;
                _typeMap = typeMap;
                _taggerProvider = taggerProvider;
                _viewSupportsClassificationServiceOpt = viewSupportsClassificationServiceOpt;
                _associatedViewService = associatedViewService;
                _editorClassificationService = editorClassificationService;
                _languageName = languageName;

                _workQueue = new AsynchronousSerialWorkQueue(asyncListener);
                _reportChangeCancellationSource = new CancellationTokenSource();

                _lastLineCache = new LastLineCache();

                _workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
                _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;

                ConnectToWorkspace(_workspaceRegistration.Workspace);
            }