public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { ITextDocument document; RobotsTxtClassifier classifier; var view = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); view.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document); if (document != null) { TextType type = GetTextType(document.FilePath); if (type == TextType.Unsupported) { return; } view.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(RobotsTxtClassifier), out classifier); if (classifier != null) { ITextSnapshot snapshot = view.TextBuffer.CurrentSnapshot; classifier.RaiseClassificationChanged(new SnapshotSpan(snapshot, 0, snapshot.Length), type); } } }
public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { ITextDocument document; DockerfileClassifier classifier; var view = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); if (TextDocumentFactoryService.TryGetTextDocument(view.TextDataModel.DocumentBuffer, out document)) { TextType type = GetTextType(document.FilePath); if (type == TextType.Unsupported) { return; } view.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(DockerfileClassifier), out classifier); view.Properties.GetOrCreateSingletonProperty(() => new CommentCommandTarget(textViewAdapter, view, "#")); if (classifier != null) { ITextSnapshot snapshot = view.TextBuffer.CurrentSnapshot; classifier.OnClassificationChanged(new SnapshotSpan(snapshot, 0, snapshot.Length), type); } } }
protected virtual IntellisenseCommandFilter CreateIntellisenseCommandFilter(IVsTextView textViewAdapter) { Contract.Requires <ArgumentNullException>(textViewAdapter != null, "textViewAdapter"); Contract.Ensures(Contract.Result <IntellisenseCommandFilter>() != null); return(new IntellisenseCommandFilter(textViewAdapter, this)); }
public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { var view = this.EditorAdaptersFactory.GetWpfTextView(textViewAdapter); view.Options.OptionChanged += OnOptionsChanged; view.LostAggregateFocus += OnLostAggregateFocus; IOleCommandTarget nextCommandTarget; if (view.Roles.Contains(PredefinedTextViewRoles.PrimaryDocument)) { CommandRouter commandRouter = CommandRouterProvider.GetCommandRouter(view); // Register internal handlers with the command router // Register the filter to execute emacs commands commandRouter.AddCommandTarget(new EmacsCommandsFilter(view, this.Manager, commandRouter)); // Register the mark session commandRouter.AddCommandTarget(this.Manager.GetOrCreateMarkSession(view)); // Register the universal argument session commandRouter.AddCommandTarget(this.Manager.GetOrCreateUniversalArgumentSession(view)); } else { // Register the filter to execute emacs commands var commandFilter = new InteractiveRoleWorkAroundFilter(view, this.Manager); textViewAdapter.AddCommandFilter(commandFilter, out nextCommandTarget); commandFilter.NextCommandTarget = nextCommandTarget; } }
public void VsTextViewCreated(IVsTextView textViewAdapter) { ITextView textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); if (textView != null) { _openedViews.Add(textView); textView.Closed += HandleTextViewClosed; } }
public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { var textView = _adaptersFactory.GetWpfTextView(textViewAdapter); IntellisenseController controller; if (textView.Properties.TryGetProperty <IntellisenseController>(typeof(IntellisenseController), out controller)) { controller.AttachKeyboardFilter(); } }
public virtual void OnVsTextViewCreated(IVsTextView textViewAdapter) { Contract.Requires <ArgumentNullException>(textViewAdapter != null, "textViewAdapter"); _commandFilter = CreateIntellisenseCommandFilter(textViewAdapter); if (_commandFilter != null) { _commandFilter.Enabled = true; } }
public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { IWpfTextView textView = editorFactory.GetWpfTextView(textViewAdapter); if (textView == null) { return; } new BookmarkReceiver(textView); }
public RoslynKeyboardFilter(ICompletionBroker completionBroker, IVsTextView textViewAdapter, ITextView textView) : base(textViewAdapter) { if (completionBroker == null) throw new ArgumentNullException("completionBroker"); if (textView == null) throw new ArgumentNullException("textView"); _completionBroker = completionBroker; _textView = textView; }
public GitDiffMarginCommandHandler(IVsTextView textViewAdapter, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextView textView) : base(textViewAdapter) { if (editorAdaptersFactoryService == null) throw new ArgumentNullException("editorAdaptersFactoryService"); if (textView == null) throw new ArgumentNullException("textView"); _editorAdaptersFactoryService = editorAdaptersFactoryService; _textView = textView; }
static IWpfTextView GetWpfTextView(VsTextView vTextView) { var userData = vTextView as VsUserData; if (userData == null) { return(null); } var guidViewHost = guidIWpfTextViewHost; userData.GetData(ref guidViewHost, out object holder); return(((IWpfTextViewHost)holder).TextView); }
void IVsTextViewCreationListener.VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { // Get wpf text view of the adapter var view = this.EditorAdaptersFactory.GetWpfTextView(textViewAdapter); // Initialize the completion controller var completionController = view.Properties.GetProperty <CompletionController>(typeof(CompletionController)); if (completionController != null) { completionController.Initialize(textViewAdapter); } }
void IVsTextViewCreationListener.VsTextViewCreated(IVsTextView textViewAdapter) { ITextView textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); if (textView != null) { IEnumerable<ITvlIntellisenseController> controllers; if (textView.Properties.TryGetProperty<IEnumerable<ITvlIntellisenseController>>(typeof(ITvlIntellisenseController), out controllers)) { foreach (var controller in controllers.OfType<IVsTextViewCreationListener>()) controller.VsTextViewCreated(textViewAdapter); } } }
public virtual void VsTextViewCreated(IVsTextView textViewAdapter) { if (textViewAdapter == null) { throw new ArgumentNullException("textViewAdapter"); } _commandFilter = CreateIntellisenseCommandFilter(textViewAdapter); if (_commandFilter != null) { _commandFilter.Enabled = true; } }
// Get IVsTextView and text in WindowActivated event void WindowEvents_WindowActivated(EnvDTE.Window GotFocus, EnvDTE.Window LostFocus) { if (GotFocus.Document != null) { EnvDTE.Document curDoc = GotFocus.Document; System.Diagnostics.Debug.Write("Activated : " + curDoc.FullName); Microsoft.VisualStudio.TextManager.Interop.IVsTextView itv = IVsTextView_FromFilePath_Get(curDoc.FullName); if (itv != null) { Microsoft.VisualStudio.TextManager.Interop.IVsTextLines tl; itv.GetBuffer(out tl); // get textlines } } }
public GitDiffMarginCommandHandler(IVsTextView textViewAdapter, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextView textView) : base(textViewAdapter) { if (editorAdaptersFactoryService == null) { throw new ArgumentNullException("editorAdaptersFactoryService"); } if (textView == null) { throw new ArgumentNullException("textView"); } _editorAdaptersFactoryService = editorAdaptersFactoryService; _textView = textView; }
public RoslynKeyboardFilter(ICompletionBroker completionBroker, IVsTextView textViewAdapter, ITextView textView) : base(textViewAdapter) { if (completionBroker == null) { throw new ArgumentNullException("completionBroker"); } if (textView == null) { throw new ArgumentNullException("textView"); } _completionBroker = completionBroker; _textView = textView; }
void IVsTextViewCreationListener.VsTextViewCreated(IVsTextView textViewAdapter) { ITextView textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); if (textView != null) { IEnumerable <ITvlIntellisenseController> controllers; if (textView.Properties.TryGetProperty <IEnumerable <ITvlIntellisenseController> >(typeof(ITvlIntellisenseController), out controllers)) { foreach (var controller in controllers.OfType <IVsTextViewCreationListener>()) { controller.VsTextViewCreated(textViewAdapter); } } } }
private void ShowFile(string fileName) { try { var tuple = this.toolWindow.SetDisplayedFile(fileName); if (tuple != null) { this.DiffEditor.Content = tuple.Item1; this.textView = tuple.Item2; } } finally { File.Delete(fileName); } }
protected virtual IntellisenseCommandFilter CreateIntellisenseCommandFilter([NotNull] IVsTextView textViewAdapter) { Requires.NotNull(textViewAdapter, nameof(textViewAdapter)); return(new IntellisenseCommandFilter(textViewAdapter, this)); }
public RoslynKeyboardFilter(ICompletionBroker completionBroker, IVsTextView textViewAdapter, ITextView textView) : base(textViewAdapter) { _completionBroker = completionBroker ?? throw new ArgumentNullException(nameof(completionBroker)); _textView = textView ?? throw new ArgumentNullException(nameof(textView)); }
protected override IntellisenseCommandFilter CreateIntellisenseCommandFilter(IVsTextView textViewAdapter) { return(new AntlrIntellisenseCommandFilter(textViewAdapter, this)); }
public override string Goto(Microsoft.VisualStudio.VSConstants.VSStd97CmdID cmd, Microsoft.VisualStudio.TextManager.Interop.IVsTextView textView, int line, int col, out Microsoft.VisualStudio.TextManager.Interop.TextSpan span) { span = new Microsoft.VisualStudio.TextManager.Interop.TextSpan(); return(null); }
public override Declarations GetDeclarations(Microsoft.VisualStudio.TextManager.Interop.IVsTextView view, int line, int col, TokenInfo info, ParseReason reason) { return(new AphidDeclarations()); }
protected virtual IntellisenseCommandFilter CreateIntellisenseCommandFilter(IVsTextView textViewAdapter) { Contract.Requires<ArgumentNullException>(textViewAdapter != null, "textViewAdapter"); Contract.Ensures(Contract.Result<IntellisenseCommandFilter>() != null); return new IntellisenseCommandFilter(textViewAdapter, this); }
int IVsTextManagerEvents2.OnUnregisterView(IVsTextView pView) { return(VSConstants.S_OK); }
protected override IntellisenseCommandFilter CreateIntellisenseCommandFilter(IVsTextView textViewAdapter) { return new Antlr4IntellisenseCommandFilter(textViewAdapter, this); }
int IVsTextManagerEvents2.OnUnregisterView(IVsTextView pView) { return VSConstants.S_OK; }
public virtual void OnVsTextViewCreated(IVsTextView textViewAdapter) { Contract.Requires<ArgumentNullException>(textViewAdapter != null, "textViewAdapter"); _commandFilter = CreateIntellisenseCommandFilter(textViewAdapter); if (_commandFilter != null) _commandFilter.Enabled = true; }
public Microsoft.VisualStudio.TextManager.Interop.TextSpan ToVsTextInteropSpan(Microsoft.VisualStudio.TextManager.Interop.IVsTextView view) { if (_end > _start) { int startLine, startPos, endLine, endPos; view.GetLineAndColumn(_start, out startLine, out startPos); view.GetLineAndColumn(_end, out endLine, out endPos); return(new Microsoft.VisualStudio.TextManager.Interop.TextSpan() { iStartLine = startLine, iStartIndex = startPos, iEndLine = endLine, iEndIndex = endPos }); } else { int startLine, startPos; view.GetLineAndColumn(_start, out startLine, out startPos); return(new Microsoft.VisualStudio.TextManager.Interop.TextSpan() { iStartLine = startLine, iStartIndex = startPos, iEndLine = startLine, iEndIndex = startPos }); } }