示例#1
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 ManagedEditAndContinueLanguageService(
     VisualStudioWorkspace workspace,
     IManagedEditAndContinueDebuggerService debuggerService,
     IDiagnosticAnalyzerService diagnosticService,
     EditAndContinueDiagnosticUpdateSource diagnosticUpdateSource)
 {
     _proxy            = new RemoteEditAndContinueServiceProxy(workspace);
     _debuggingService = workspace.Services.GetRequiredService <IDebuggingWorkspaceService>();
     _activeStatementTrackingService = workspace.Services.GetRequiredService <IActiveStatementTrackingService>();
     _debuggerService        = debuggerService;
     _diagnosticService      = diagnosticService;
     _diagnosticUpdateSource = diagnosticUpdateSource;
 }
 public VisualStudioDebugStateChangeListener(VisualStudioWorkspace workspace)
 {
     _workspace        = workspace;
     _debuggingService = workspace.Services.GetRequiredService <IDebuggingWorkspaceService>();
     _activeStatementTrackingService = workspace.Services.GetRequiredService <IActiveStatementTrackingService>();
 }
 public VisualStudioDebugStateChangeListener(VisualStudioWorkspace workspace, VisualStudioDebuggeeModuleMetadataProvider moduleMetadataProvider)
 {
     _moduleMetadataProvider = moduleMetadataProvider;
     _debuggingService       = workspace.Services.GetRequiredService <IDebuggingWorkspaceService>();
     _encService             = workspace.Services.GetRequiredService <IEditAndContinueWorkspaceService>();
 }