/// <summary> /// Primary entry point for intellisense. This is where intellisense list is getting created. /// </summary> /// <param name="session">Completion session</param> /// <param name="completionSets">Completion sets to populate</param> public void AugmentCompletionSession(ICompletionSession session, IList <CompletionSet> completionSets) { Debug.Assert(EditorShell.IsUIThread); IREditorDocument doc = REditorDocument.TryFromTextBuffer(_textBuffer); if (doc == null) { return; } int position = session.GetTriggerPoint(_textBuffer).GetPosition(_textBuffer.CurrentSnapshot); if (!doc.EditorTree.IsReady) { doc.EditorTree.InvokeWhenReady((o) => { RCompletionController controller = ServiceManager.GetService <RCompletionController>(session.TextView); if (controller != null) { controller.ShowCompletion(autoShownCompletion: true); controller.FilterCompletionSession(); } }, null, this.GetType(), processNow: true); } else { PopulateCompletionList(position, session, completionSets, doc.EditorTree.AstRoot); } }
private void DismissAsyncSession() { if (_asyncSession != null && _asyncSession.Properties != null && _asyncSession.Properties.ContainsProperty(_asyncIntellisenseSession) && !_asyncSession.IsDismissed) { RCompletionController controller = ServiceManager.GetService <RCompletionController>(_asyncSession.TextView); if (controller != null) { controller.DismissCompletionSession(); } } _asyncSession = null; }
public static RCompletionController Create( ITextView textView, IList<ITextBuffer> subjectBuffers, ICompletionBroker completionBroker, IQuickInfoBroker quickInfoBroker, ISignatureHelpBroker signatureBroker) { RCompletionController completionController = null; completionController = ServiceManager.GetService<RCompletionController>(textView); if (completionController == null) { completionController = new RCompletionController(textView, subjectBuffers, completionBroker, quickInfoBroker, signatureBroker); } return completionController; }
private void TreeUpdatedCallback() { if (_asyncSession == null) { return; } RCompletionController controller = ServiceManager.GetService <RCompletionController>(_asyncSession.TextView); _asyncSession = null; if (controller != null) { controller.ShowCompletion(autoShownCompletion: true); controller.FilterCompletionSession(); } }
public static RCompletionController Create( ITextView textView, IList <ITextBuffer> subjectBuffers, ICompletionBroker completionBroker, IQuickInfoBroker quickInfoBroker, ISignatureHelpBroker signatureBroker) { RCompletionController completionController = null; completionController = ServiceManager.GetService <RCompletionController>(textView); if (completionController == null) { completionController = new RCompletionController(textView, subjectBuffers, completionBroker, quickInfoBroker, signatureBroker); } return(completionController); }
private void HandleF1Help(RCompletionController controller) { VsAppShell.Current.PostCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdHelpOnCurrent); }
private void HandleCancel(RCompletionController controller) { // Post interrupt command which knows if it can interrupt R or not VsAppShell.Current.PostCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdInterruptR); }
private CommandResult HandleEnter(RCompletionController controller) { // If completion is up, commit it if (controller.HasActiveCompletionSession) { // Check for exact match. If applicable span is 'x' and completion is 'x' // then we don't complete and rather execute. If span is 'x' while // current completion entry is 'X11' then we complete depending on // the 'complete on enter' setting. try { ICompletionSession session = controller.CompletionSession; CompletionSet set = session.SelectedCompletionSet; ITrackingSpan span = set.ApplicableTo; ITextSnapshot snapshot = span.TextBuffer.CurrentSnapshot; string spanText = snapshot.GetText(span.GetSpan(snapshot)); if (spanText != set.SelectionStatus.Completion.InsertionText) { // If selection is does not match typed text, // control completion depending on the editor setting. if (set.SelectionStatus.IsSelected && REditorSettings.CommitOnEnter) { controller.CommitCompletionSession(); controller.DismissAllSessions(); return CommandResult.Executed; } } } catch (Exception) { } } controller.DismissAllSessions(); ICompletionBroker broker = VsAppShell.Current.ExportProvider.GetExportedValue<ICompletionBroker>(); broker.DismissAllSessions(TextView); var interactiveWorkflowProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRInteractiveWorkflowProvider>(); interactiveWorkflowProvider.GetOrCreate().Operations.ExecuteCurrentExpression(TextView, FormatReplDocument); return CommandResult.Executed; }
private void HandleF1Help(RCompletionController controller) { IVsUIShell uiShell = VsAppShell.Current.GetGlobalService<IVsUIShell>(typeof(SVsUIShell)); Guid gmdSet = RGuidList.RCmdSetGuid; object o = new object(); // Post interrupt command which knows if it can interrupt R or not uiShell.PostExecCommand(ref gmdSet, RPackageCommandId.icmdHelpOnCurrent, 0, ref o); }