示例#1
0
 public ExpandCommand(IWpfTextView view, ICompletionBroker broker, ITextBufferUndoManagerProvider undoProvider, IClassifier classifier)
 {
     _view        = view;
     _broker      = broker;
     _undoManager = undoProvider.GetTextBufferUndoManager(view.TextBuffer);
     _classifier  = classifier;
 }
        public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);

            if (!DocumentService.TryGetTextDocument(view.TextBuffer, out ITextDocument doc))
            {
                return;
            }

            string ext = Path.GetExtension(doc.FilePath);

            if (!FileExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase))
            {
                return;
            }

            ITextBufferUndoManager undoManager = UndoProvider.GetTextBufferUndoManager(view.TextBuffer);
            NodeProcess            node        = view.Properties.GetOrCreateSingletonProperty(() => new NodeProcess());

            AddCommandFilter(textViewAdapter, new SortCommand(view, undoManager, node));
            AddCommandFilter(textViewAdapter, new ModeCommand());

            if (!node.IsReadyToExecute())
            {
                await Install(node);
            }
        }
示例#3
0
        internal ITextBufferUndoManager CreateTextBuffer(string contents, string documentType, out UndoTransactionMarker topUndoStackMarker)
        {
            ITextBufferUndoManager textBuffer = this.CreateTextBuffer(contents, documentType);

            topUndoStackMarker = this.undoHistoryRegistry.GetUndoTransactionMarker("TopMarker");
            return(textBuffer);
        }
示例#4
0
 public MyCommand(IWpfTextView textView, MyFormatter formatter, ITextDocument document, ITextBufferUndoManager undoManager)
 {
     _textView    = textView;
     _formatter   = formatter;
     _document    = document;
     _undoManager = undoManager;
 }
示例#5
0
 public PrettierCommand(IWpfTextView view, ITextBufferUndoManager undoManager, NodeProcess node, Encoding encoding)
 {
     _view        = view;
     _undoManager = undoManager;
     _node        = node;
     _encoding    = encoding;
 }
示例#6
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            Telemetry.TrackOperation("FileOpened");
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);

            _buffer = view.TextBuffer;

            _buffer.Properties.GetOrCreateSingletonProperty(() => view);

            ITextBufferUndoManager undoManager = UndoProvider.GetTextBufferUndoManager(view.TextBuffer);

            AddCommandFilter(textViewAdapter, new FormatterCommand(view, undoManager));
            AddCommandFilter(textViewAdapter, new CompletionController(view, CompletionBroker, QuickInfoBroker));
            AddCommandFilter(textViewAdapter, new F1Help());
            AddCommandFilter(textViewAdapter, new NavigateToParent(_buffer));
            AddCommandFilter(textViewAdapter, new SignatureHelpCommand(view, SignatureHelpBroker, QuickInfoBroker));
            AddCommandFilter(textViewAdapter, new HideDefaultCommands());
            AddCommandFilter(textViewAdapter, new EnableSnippetsCommand(textViewAdapter, view, NavigatorService));

            if (textViewAdapter is IVsTextViewEx viewEx)
            {
                ErrorHandler.ThrowOnFailure(viewEx.PersistOutliningState());
            }

            if (DocumentService.TryGetTextDocument(_buffer, out ITextDocument document))
            {
                document.FileActionOccurred += DocumentSavedAsync;
            }

            view.Closed += OnViewClosed;
        }
示例#7
0
        public IDropHandler GetAssociatedDropHandler(IWpfTextView view)
        {
            try
            {
                ITextBufferUndoManager undoManager = this.UndoProvider.GetTextBufferUndoManager(view.TextBuffer);

                var vsa = new VisualStudioAbstraction(Logger, Package, dte);

                var projType = ProjectType.Unknown;

                if (this.TextDocumentFactoryService.TryGetTextDocument(view.TextBuffer, out ITextDocument textDocument))
                {
                    var proj = ProjectHelpers.Dte.Solution.GetProjectContainingFile(textDocument.FilePath);
                    projType = vsa.GetProjectType(proj);

                    Logger?.RecordInfo(StringRes.Info_DetectedProjectType.WithParams(projType.GetDescription()));
                }

                return(view.Properties.GetOrCreateSingletonProperty(() => new RapidXamlDropHandler(Logger, view, undoManager, vsa, projType, solution)));
            }
            catch (Exception exc)
            {
                RxtOutputPane.Instance.Write(RxtLogger.TimeStampMessage(StringRes.Error_UnableToGetDropHandler));
                Logger?.RecordException(exc);
                return(null);
            }
        }
        public IDropHandler GetAssociatedDropHandler(IWpfTextView view)
        {
            ITextBufferUndoManager undoManager = this.UndoProvider.GetTextBufferUndoManager(view.TextBuffer);

            var vsa = new VisualStudioAbstraction(Logger, Package, dte);

            return(view.Properties.GetOrCreateSingletonProperty(() => new RapidXamlDropHandler(Logger, view, undoManager, vsa)));
        }
示例#9
0
 public RapidXamlDropHandler(ILogger logger, IWpfTextView view, ITextBufferUndoManager undoManager, IVisualStudioAbstraction vs, IFileSystemAbstraction fileSystem = null)
 {
     this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     this.view        = view;
     this.undoManager = undoManager;
     this.vs          = vs ?? throw new ArgumentNullException(nameof(vs));
     this.fileSystem  = fileSystem ?? new WindowsFileSystem();
 }
示例#10
0
 public ExpandCommand(IWpfTextView view, ICompletionBroker broker, ITextBufferUndoManagerProvider undoProvider, IClassifier classifier)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     _view        = view;
     _broker      = broker;
     _undoManager = undoProvider.GetTextBufferUndoManager(view.TextBuffer);
     _classifier  = classifier;
     _dte         = Package.GetGlobalService(typeof(DTE)) as DTE;
 }
示例#11
0
        public void Initialize(ITextView view, IEditorOperations editorOperations, ITextBufferUndoManager undoManager) {
            Debug.Assert(view != null, "view must not be null");
            Debug.Assert(editorOperations != null, "editor operations must not be null");

            _view = view;
            _editorOperations = editorOperations;
            _undoManager = undoManager;
            _braceCompletionTarget = new BraceCompletionCommandTarget(view);
        }
示例#12
0
 public BraceCompletionContext(
     ISmartIndentationService smartIndentationService,
     ITextBufferUndoManager undoManager,
     IEditorBraceCompletionSession editorSession)
 {
     _smartIndentationService = smartIndentationService;
     _undoManager             = undoManager;
     _editorSession           = editorSession;
 }
        public PrettierCommand(IWpfTextView view, ITextBufferUndoManager undoManager, Encoding encoding, string filePath)
        {
            _view        = view;
            _undoManager = undoManager;
            _encoding    = encoding;
            _filePath    = filePath;

            _node = PrettierPackage._node;
        }
示例#14
0
        public void Initialize(ITextView view, IEditorOperations editorOperations, ITextBufferUndoManager undoManager)
        {
            Debug.Assert(view != null, "view must not be null");
            Debug.Assert(editorOperations != null, "editor operations must not be null");

            _view                  = view;
            _editorOperations      = editorOperations;
            _undoManager           = undoManager;
            _braceCompletionTarget = new BraceCompletionCommandTarget(view);
        }
示例#15
0
 public TextViewUndoManager(IDsWpfTextView textView, ITextViewUndoManagerProvider textViewUndoManagerProvider, ITextBufferUndoManagerProvider textBufferUndoManagerProvider)
 {
     TextView = textView ?? throw new ArgumentNullException(nameof(textView));
     this.textViewUndoManagerProvider   = textViewUndoManagerProvider ?? throw new ArgumentNullException(nameof(textViewUndoManagerProvider));
     this.textBufferUndoManagerProvider = textBufferUndoManagerProvider ?? throw new ArgumentNullException(nameof(textBufferUndoManagerProvider));
     textBufferUndoManager       = textBufferUndoManagerProvider.GetTextBufferUndoManager(TextView.TextBuffer);
     undoRedoCommandTargetFilter = new UndoRedoCommandTargetFilter(this);
     TextView.CommandTarget.AddFilter(undoRedoCommandTargetFilter, CommandTargetFilterOrder.UndoRedo);
     TextView.Closed += TextView_Closed;
 }
示例#16
0
        public CompoundUndoAction(ITextView textView, IEditorShell editorShell, bool addRollbackOnCancel = true) {
            if (!editorShell.IsUnitTestEnvironment) {
                IEditorOperationsFactoryService operationsService = editorShell.ExportProvider.GetExportedValue<IEditorOperationsFactoryService>();
                ITextBufferUndoManagerProvider undoProvider = editorShell.ExportProvider.GetExportedValue<ITextBufferUndoManagerProvider>();

                _editorOperations = operationsService.GetEditorOperations(textView);
                _undoManager = undoProvider.GetTextBufferUndoManager(_editorOperations.TextView.TextBuffer);
                _addRollbackOnCancel = addRollbackOnCancel;
            }
        }
 public RapidXamlDropHandler(ILogger logger, IWpfTextView view, ITextBufferUndoManager undoManager, IVisualStudioAbstractionAndDocumentModelAccess vs, ProjectType projectType, IVsSolution solution, IFileSystemAbstraction fileSystem = null)
 {
     this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     this.view        = view;
     this.undoManager = undoManager;
     this.vs          = vs ?? throw new ArgumentNullException(nameof(vs));
     this.projectType = projectType;
     this.solution    = solution;
     this.fileSystem  = fileSystem ?? new WindowsFileSystem();
 }
示例#18
0
 public void Dispose()
 {
     if (this.undoManager == null)
     {
         return;
     }
     this.TextBuffer.Changed -= new EventHandler <TextContentChangedEventArgs>(this.TextBuffer_Changed);
     this.UndoHistory.UndoTransactionCompleted -= new EventHandler <UndoTransactionCompletedEventArgs>(this.UndoHistory_UndoTransactionCompleted);
     this.undoManager.UnregisterUndoHistory();
     this.undoManager = (ITextBufferUndoManager)null;
 }
示例#19
0
        public CompoundUndoAction(ITextView textView, ITextBuffer textBuffer, bool addRollbackOnCancel = true)
        {
            if (!EditorShell.Current.IsUnitTestEnvironment)
            {
                IEditorOperationsFactoryService operationsService = EditorShell.Current.ExportProvider.GetExport <IEditorOperationsFactoryService>().Value;
                ITextBufferUndoManagerProvider  undoProvider      = EditorShell.Current.ExportProvider.GetExport <ITextBufferUndoManagerProvider>().Value;

                _editorOperations    = operationsService.GetEditorOperations(textView);
                _undoManager         = undoProvider.GetTextBufferUndoManager(_editorOperations.TextView.TextBuffer);
                _addRollbackOnCancel = addRollbackOnCancel;
            }
        }
示例#20
0
        public CompoundUndoAction(ITextView textView, IEditorShell editorShell, bool addRollbackOnCancel = true)
        {
            if (!editorShell.IsUnitTestEnvironment)
            {
                IEditorOperationsFactoryService operationsService = editorShell.GlobalServices.GetService <IEditorOperationsFactoryService>();
                ITextBufferUndoManagerProvider  undoProvider      = editorShell.GlobalServices.GetService <ITextBufferUndoManagerProvider>();

                _editorOperations    = operationsService.GetEditorOperations(textView);
                _undoManager         = undoProvider.GetTextBufferUndoManager(_editorOperations.TextView.TextBuffer);
                _addRollbackOnCancel = addRollbackOnCancel;
            }
        }
示例#21
0
        public CompoundUndoAction(IEditorView editorView, IServiceContainer services, bool addRollbackOnCancel = true)
        {
            var shell = services.GetService <ICoreShell>();

            if (TestEnvironment.Current == null)
            {
                var operationsService = services.GetService <IEditorOperationsFactoryService>();
                var undoProvider      = services.GetService <ITextBufferUndoManagerProvider>();

                _editorOperations    = operationsService.GetEditorOperations(editorView.As <ITextView>());
                _undoManager         = undoProvider.GetTextBufferUndoManager(_editorOperations.TextView.TextBuffer);
                _addRollbackOnCancel = addRollbackOnCancel;
            }
        }
示例#22
0
		public TextViewUndoManager(IDsWpfTextView textView, ITextViewUndoManagerProvider textViewUndoManagerProvider, ITextBufferUndoManagerProvider textBufferUndoManagerProvider) {
			if (textView == null)
				throw new ArgumentNullException(nameof(textView));
			if (textViewUndoManagerProvider == null)
				throw new ArgumentNullException(nameof(textViewUndoManagerProvider));
			if (textBufferUndoManagerProvider == null)
				throw new ArgumentNullException(nameof(textBufferUndoManagerProvider));
			TextView = textView;
			this.textViewUndoManagerProvider = textViewUndoManagerProvider;
			this.textBufferUndoManagerProvider = textBufferUndoManagerProvider;
			textBufferUndoManager = textBufferUndoManagerProvider.GetTextBufferUndoManager(TextView.TextBuffer);
			undoRedoCommandTargetFilter = new UndoRedoCommandTargetFilter(this);
			TextView.CommandTarget.AddFilter(undoRedoCommandTargetFilter, CommandTargetFilterOrder.UndoRedo);
			TextView.Closed += TextView_Closed;
		}
示例#23
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);

            if (!DocumentService.TryGetTextDocument(view.TextBuffer, out ITextDocument doc))
            {
                return;
            }

            ITextBufferUndoManager undoManager = UndoProvider.GetTextBufferUndoManager(view.TextBuffer);

            var cmd = new PrettierCommand(view, undoManager, doc.Encoding, doc.FilePath);

            view.Properties.AddProperty("prettierCommand", cmd);

            AddCommandFilter(textViewAdapter, cmd);
        }
示例#24
0
        internal CodeEditor(IWpfTextView textView, IWpfTextViewHost textViewHost, IEditorOperations editorCommands, ITextBufferUndoManager undoService, IFindLogic findLogic, IClassificationTypeRegistry classificationRegistry, IClassificationFormatMap classificationFormatMap, ISquiggleProvider squiggleProvider, ICompletionBroker completionBroker, CodeOptionsModel codeOptionsModel, IMessageDisplayService messageDisplayService, ICodeAidProvider codeAidProvider, IEnvironment environment)
        {
            this.textView                = textView;
            this.textViewHost            = textViewHost;
            this.findLogic               = findLogic;
            this.classificationRegistry  = classificationRegistry;
            this.classificationFormatMap = classificationFormatMap;
            this.editorCommands          = editorCommands;
            this.undoService             = undoService;
            this.squiggleProvider        = squiggleProvider;
            this.environment             = environment;
            this.messageDisplayService   = messageDisplayService;
            this.codeEditorOperations    = new CodeEditorOperations(this, completionBroker, codeAidProvider);
            FrameworkElement element1 = this.Element;

            element1.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
            element1.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
            element1.GotFocus  += new RoutedEventHandler(this.Editor_GotFocus);
            this.textView.Caret.PositionChanged   += new EventHandler <CaretPositionChangedEventArgs>(this.Caret_PositionChanged);
            this.textView.Background               = (Brush)Brushes.White;
            this.textView.Selection.UnfocusedBrush = (Brush)Brushes.LightGray;
            this.verticalScollBar = (IWpfTextViewMargin)this.textViewHost.GetTextViewMargin("Wpf Vertical Scrollbar");
            UIElement element2 = ((IWpfTextViewMargin)this.textViewHost.GetTextViewMargin("Wpf Horizontal Scrollbar")).VisualElement.Parent as UIElement;

            if (element2 != null)
            {
                Grid.SetColumn(element2, 0);
                Grid.SetColumnSpan(element2, 2);
            }
            this.lineNumberMargin = (IWpfLineNumberMargin)this.textViewHost.GetTextViewMargin("Wpf Line Number Margin");
            this.lineNumberMargin.BackgroundBrush = (Brush) new SolidColorBrush(Colors.White);
            Border border = this.textViewHost.GetTextViewMargin("Spacer Margin") as Border;

            if (border != null)
            {
                border.BorderBrush     = (Brush) new SolidColorBrush(Color.FromRgb((byte)204, (byte)204, (byte)204));
                border.Margin          = new Thickness(2.0, 0.0, 0.0, 0.0);
                border.BorderThickness = new Thickness(1.0, 0.0, 0.0, 0.0);
            }
            this.textViewHost.BottomRightMarginCorner = (UIElement) new CodeEditorCorner();
            this.codeOptionsModel = codeOptionsModel;
            this.codeOptionsModel.PropertyChanged           += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
            this.editorSpecificOptionsModel                  = this.codeOptionsModel.GetEditorModel(this.codeOptionsModel.GetEditorType(this.TextBuffer));
            this.editorSpecificOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
            this.UpdateOptions();
        }
示例#25
0
        public NQueryCodeActionsMargin(Workspace workspace, IWpfTextViewHost textViewHost, ITextBufferUndoManager textBufferUndoManager, ImmutableArray <ICodeFixProvider> fixProviders, ImmutableArray <ICodeIssueProvider> issueProviders, ImmutableArray <ICodeRefactoringProvider> refactoringProviders)
        {
            _workspace = workspace;
            _workspace.CurrentDocumentChanged += WorkspaceOnCurrentDocumentChanged;
            _textViewHost          = textViewHost;
            _textBufferUndoManager = textBufferUndoManager;
            _textViewHost.TextView.Caret.PositionChanged += CaretOnPositionChanged;
            _textViewHost.TextView.LayoutChanged         += TextViewOnLayoutChanged;
            _textViewHost.TextView.ZoomLevelChanged      += TextViewOnZoomLevelChanged;
            _fixProviders         = fixProviders;
            _issueProviders       = issueProviders;
            _refactoringProviders = refactoringProviders;

            Width = 16;
            SetLeft(_glyphPopup, 0);
            Children.Add(_glyphPopup);
        }
示例#26
0
        internal CodeEditor CreateCodeEditor(Microsoft.VisualStudio.Text.ITextBuffer textBuffer)
        {
            EditingService.DefaultEnvironment defaultEnvironment = new EditingService.DefaultEnvironment();
            IWpfTextViewHost textViewHost = this.textEditorFactoryProvider.CreateTextViewHost(textBuffer, (IEnvironment)defaultEnvironment, false);

            defaultEnvironment.SetTextViewHost(textViewHost);
            IWpfTextView                textView              = textViewHost.TextView;
            IEditorOperations           editorOperations      = this.editorCommandsProvider.GetEditorOperations((ITextView)textView);
            ITextBufferUndoManager      bufferUndoManager     = this.undoManagerProvider.GetTextBufferUndoManager(textBuffer);
            IFindLogic                  service1              = this.loader.GetService <IFindLogic>();
            IClassificationTypeRegistry service2              = this.loader.GetService <IClassificationTypeRegistry>();
            IClassificationFormatMap    service3              = this.loader.GetService <IClassificationFormatMap>();
            ISquiggleProvider           squiggleProvider      = this.squiggleProviderFactory.GetSquiggleProvider((ITextView)textView);
            ICompletionBroker           brokerForTextView     = this.completionBrokerMap.GetBrokerForTextView((ITextView)textView);
            IMessageDisplayService      messageDisplayService = (IMessageDisplayService)this.serviceProvider.GetService(typeof(IMessageDisplayService));
            ICodeAidProvider            codeAidProvider       = this.GetCodeAidProvider();

            return(new CodeEditor(textView, textViewHost, editorOperations, bufferUndoManager, service1, service2, service3, squiggleProvider, brokerForTextView, this.codeOptionsModel, messageDisplayService, codeAidProvider, (IEnvironment)defaultEnvironment));
        }
        public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);

            if (!DocumentService.TryGetTextDocument(view.TextBuffer, out ITextDocument doc))
            {
                return;
            }

            ITextBufferUndoManager undoManager = UndoProvider.GetTextBufferUndoManager(view.TextBuffer);
            NodeProcess            node        = view.Properties.GetOrCreateSingletonProperty(() => new NodeProcess());

            AddCommandFilter(textViewAdapter, new PrettierCommand(view, undoManager, node, doc.Encoding, doc.FilePath));

            if (!node.IsReadyToExecute())
            {
                await Install(node);
            }
        }
示例#28
0
        private static async Task <bool> ExecuteAsync(IWpfTextView view, ITextBufferUndoManager undoManager, NodeProcess node)
        {
            string input  = view.TextBuffer.CurrentSnapshot.GetText();
            string output = await node.ExecuteProcess(input);

            if (string.IsNullOrEmpty(output) || input == output)
            {
                return(false);
            }

            using (ITextEdit edit = view.TextBuffer.CreateEdit())
                using (ITextUndoTransaction undo = undoManager.TextBufferUndoHistory.CreateTransaction("Sort properties"))
                {
                    edit.Replace(0, view.TextBuffer.CurrentSnapshot.Length, output);
                    edit.Apply();

                    undo.Complete();
                }

            return(true);
        }
示例#29
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.textBuffer != null)
         {
             this.textBuffer = (ITextBuffer)null;
         }
         if (this.undoManager != null)
         {
             this.undoManager.TextBufferUndoHistory.UndoRedoHappened         -= new EventHandler <UndoRedoEventArgs>(this.TextBufferUndoHistory_UndoRedoHappened);
             this.undoManager.TextBufferUndoHistory.UndoTransactionCompleted -= new EventHandler <UndoTransactionCompletedEventArgs>(this.TextBufferUndoHistory_UndoTransactionCompleted);
             this.undoManager = (ITextBufferUndoManager)null;
         }
         if (this.topMarker != null)
         {
             this.topMarker = (UndoTransactionMarker)null;
         }
     }
     base.Dispose(disposing);
 }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);

            if (!DocumentService.TryGetTextDocument(view.TextBuffer, out ITextDocument doc))
            {
                return;
            }

            ITextBufferUndoManager undoManager = UndoProvider.GetTextBufferUndoManager(view.TextBuffer);
            NodeProcess            node        = view.Properties.GetOrCreateSingletonProperty(() => new NodeProcess());

            var cmd = new PrettierCommand(view, undoManager, node, doc.Encoding, doc.FilePath);

            view.Properties.AddProperty("prettierCommand", cmd);

            AddCommandFilter(textViewAdapter, cmd);

            if (!node.IsReadyToExecute())
            {
                node.EnsurePackageInstalledAsync().ConfigureAwait(false);
            }
        }
 public AutoPrefixCommand(IWpfTextView view, ITextBufferUndoManager undoManager, NodeProcess node)
 {
     _view        = view;
     _undoManager = undoManager;
     _node        = node;
 }
示例#32
0
 public FormatterCommand(IWpfTextView textView, ITextBufferUndoManager undoManager)
 {
     _view        = textView;
     _undoManager = undoManager;
 }
            /// <summary>
            /// Creates and adds a new language buffer to the projection buffer.
            /// </summary>
            private void AddLanguageBuffer()
            {
                ITextBuffer buffer = _factory.CreateAndActivateBuffer(_window);

                if (CurrentLanguageBuffer != null)
                {
                    _undoManager.UnregisterUndoHistory();
                    _textBufferUndoManagerProvider.RemoveTextBufferUndoManager(CurrentLanguageBuffer);
                }
                _undoManager = _textBufferUndoManagerProvider.GetTextBufferUndoManager(buffer);

                buffer.Properties.AddProperty(typeof(IInteractiveEvaluator), Evaluator);
                buffer.Properties.AddProperty(typeof(InteractiveWindow), _window);

                CurrentLanguageBuffer = buffer;
                _window.SubmissionBufferAdded?.Invoke(_window, new SubmissionBufferAddedEventArgs(buffer));

                _window.LanguageBufferCounter++;

                // add the whole buffer to the projection buffer and set it up to expand to the right as text is appended
                var promptSpan = CreatePrimaryPrompt();
                var languageSpan = new CustomTrackingSpan(
                    CurrentLanguageBuffer.CurrentSnapshot,
                    new Span(0, 0),
                    canAppend: true);

                // projection buffer update must be the last operation as it might trigger event that accesses prompt line mapping:
                AppendProjectionSpans(promptSpan, languageSpan);
            }
示例#34
0
 public EditableTextBuffer(ITextBufferUndoManager undoManager)
 {
     this.undoManager         = undoManager;
     this.TextBuffer.Changed += new EventHandler <TextContentChangedEventArgs>(this.TextBuffer_Changed);
     this.UndoHistory.UndoTransactionCompleted += new EventHandler <UndoTransactionCompletedEventArgs>(this.UndoHistory_UndoTransactionCompleted);
 }