public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { ICompletionSession completionSession = session as ICompletionSession; if (completionSession == null) return null; return new SparkSensePresenter(completionSession); }
private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, IIntellisenseSession session) { var currentPoint = (session.TextView.Caret.Position.BufferPosition) - 1; var navigator = _sourceProvider.NavigatorService.GetTextStructureNavigator(_textBuffer); var extent = navigator.GetExtentOfWord(currentPoint); return currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive); }
public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { var quickInfoSession = session as IQuickInfoSession; if (quickInfoSession == null) return null; if (quickInfoSession.TrackMouse) return new QuickInfoPresenter(quickInfoSession); return new SpaceReservationQuickInfoPresenter(quickInfoSession); }
public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { IQuickInfoSession qiSession = session as IQuickInfoSession; if ( qiSession != null ) { if ( qiSession.Get<RainbowToolTipContext>() != null ) { return new RainbowToolTipPresenter(qiSession, this); } } return null; }
public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { ICompletionSession completionSession = session as ICompletionSession; if (completionSession != null) { return new CompletionSessionPresenter(ServiceProvider, completionSession); } return null; }
public void SessionCreated(IIntellisenseSession session) { if (session == null) throw new ArgumentNullException(nameof(session)); if (!CurrentLineSpaceReservationAgent.IsSupportedSession(session)) return; var wpfTextView = session.TextView as IWpfTextView; Debug.Assert(wpfTextView != null); if (wpfTextView == null) return; var currentLineAgent = session.TextView.Properties.GetOrCreateSingletonProperty(typeof(CurrentLineSpaceReservationAgent), () => new CurrentLineSpaceReservationAgent(wpfTextView)); currentLineAgent.SessionCreated(session); }
public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { if (session == null) throw new ArgumentNullException(nameof(session)); var contentTypes = session.TextView.BufferGraph.GetTextBuffers(a => session.GetTriggerPoint(a) != null).Select(a => a.ContentType).ToArray(); foreach (var lz in intellisensePresenterProviders) { foreach (var contentType in contentTypes) { if (!contentType.IsOfAnyType(lz.Metadata.ContentTypes)) continue; var presenter = lz.Value.TryCreateIntellisensePresenter(session); if (presenter != null) return presenter; } } return null; }
IIntellisensePresenter IIntellisensePresenterProvider.TryCreateIntellisensePresenter(IIntellisenseSession session) { // If this is not associated with an IWordCompletionSession then we don't want to special case // this in any way if (!session.Properties.ContainsProperty(WordCompletionSessionFactoryService.WordCompletionSessionKey)) { return null; } foreach (var provider in Providers) { if (provider == this) { // Don't consider 'this' here. It would lead to an infinite loop continue; } try { var presenter = provider.TryCreateIntellisensePresenter(session); var popupPresenter = presenter as IPopupIntellisensePresenter; // We only need to wrap IPopupIntellisensePresenter values as they are the // only ones which expose opacity if (popupPresenter != null) { return new WordCompletionPresenter(popupPresenter); } if (presenter != null) { return presenter; } } catch (Exception) { // Move onto the next provider } } return null; }
public void MoveSessionToTop(IIntellisenseSession session) { if (wpfTextView.IsClosed) { throw new InvalidOperationException(); } if (session == null) { throw new ArgumentNullException(nameof(session)); } int index = sessions.IndexOf(session); if (index < 0) { throw new InvalidOperationException(); } if (index == 0) { return; } sessions.Move(index, 0); }
internal static Xwt.Rectangle GetScreenRect(IIntellisenseSession session) { return(Xwt.MessageDialog.RootWindow.Screen.VisibleBounds); //TODO //if ((session != null) && (session.TextView != null)) { // Visual sessionViewVisual = ((IWpfTextView)session.TextView).VisualElement; // if ((sessionViewVisual != null) && PresentationSource.FromVisual (sessionViewVisual) != null) { // Rect nativeScreenRect = WpfHelper.GetScreenRect (sessionViewVisual.PointToScreen (new Point (0, 0))); // return new Rect // (0, // 0, // nativeScreenRect.Width * WpfHelper.DeviceScaleX, // nativeScreenRect.Height * WpfHelper.DeviceScaleY); // } //} //return new Rect // (0, // 0, // SystemParameters.PrimaryScreenWidth * WpfHelper.DeviceScaleX, // SystemParameters.PrimaryScreenHeight * WpfHelper.DeviceScaleY); }
public void PushSession(IIntellisenseSession session) { if (wpfTextView.IsClosed) { throw new InvalidOperationException(); } if (session == null) { throw new ArgumentNullException(nameof(session)); } if (sessions.Contains(session)) { throw new InvalidOperationException(); } if (sessions.Count == 0) { commandTargetFilter.HookKeyboard(); } sessions.Insert(0, session); session.Dismissed += Session_Dismissed; session.PresenterChanged += Session_PresenterChanged; PresenterUpdated(session); }
private void DoleOutKeyboard() { if (_keyboardSession != null) { this.ReleaseKeyboard(); } // The idea is to walk down the stack from top to bottom, looking for the first session that has a presenter. When we // find it, give it the keyboard, unless it already has it. foreach (IIntellisenseSession session in _sessions) { ICustomKeyboardHandler keyboardHandler = session.Presenter as ICustomKeyboardHandler; if (keyboardHandler != null) { if (keyboardHandler.CaptureKeyboard()) { _keyboardSession = session; break; } } } }
public static IEditorIntellisenseSession ToEditorIntellisenseSession(this IIntellisenseSession session) => session.Properties.TryGetProperty(EditorIntellisenseSession.SessionKey, out IEditorIntellisenseSession es) ? es : null;
IIntellisensePresenter IIntellisensePresenterProvider.TryCreateIntellisensePresenter(IIntellisenseSession session) { // If this is not associated with an IWordCompletionSession then we don't want to special case // this in any way if (!session.Properties.ContainsProperty(WordCompletionSessionFactoryService.WordCompletionSessionKey)) { return(null); } foreach (var provider in Providers) { if (provider == this) { // Don't consider 'this' here. It would lead to an infinite loop continue; } try { var presenter = provider.TryCreateIntellisensePresenter(session); var popupPresenter = presenter as IPopupIntellisensePresenter; // We only need to wrap IPopupIntellisensePresenter values as they are the // only ones which expose opacity if (popupPresenter != null) { return(new WordCompletionPresenter(popupPresenter)); } if (presenter != null) { return(presenter); } } catch (Exception) { // Move onto the next provider } } return(null); }
public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { var completionSession = session as ICompletionSession; if (completionSession == null) return null; return new CompletionPresenter(imageMonikerService, completionSession, completionTextElementProviderService.Value.Create(), completionUIElementProviders); }
public SimpleCompletionEntry(string displayText, string insertionText, string description, IIntellisenseSession session) : base(displayText, insertionText, description, _glyph, null, false, session as ICompletionSession) { }
public void PushSession(IIntellisenseSession session) { session.Dismissed += session_Dismissed; _stack.Add(session); }
public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session) { var signatureHelpSession = session as ISignatureHelpSession; if (signatureHelpSession == null) return null; return new SignatureHelpPresenter(signatureHelpSession, textBufferFactoryService, contentTypeRegistryService, classifierAggregatorService, classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.SignatureHelpToolTip)); }
public void MoveSessionToTop(IIntellisenseSession session) { if (wpfTextView.IsClosed) throw new InvalidOperationException(); if (session == null) throw new ArgumentNullException(nameof(session)); int index = sessions.IndexOf(session); if (index < 0) throw new InvalidOperationException(); if (index == 0) return; sessions.Move(index, 0); }
public SimpleCompletionEntry(string text, ImageSource glyph, IIntellisenseSession session) : this(text, null, glyph, session) { }
public SimpleCompletionEntry(string text, string description, ImageMoniker moniker, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, WpfUtil.GetIconForImageMoniker(moniker, 16, 16), null, false, session as ICompletionSession) { }
public SessionState(IIntellisenseSession session) { Session = session; }
public SimpleCompletionEntry(string text, ImageMoniker moniker, IIntellisenseSession session) : this(text, null, WpfUtil.GetIconForImageMoniker(moniker, 16, 16), session) { }
void PresenterUpdated(IIntellisenseSession session) { var sessionState = GetSessionState(session); if (sessionState.SpaceReservationAgent != null) sessionState.SpaceReservationManager.RemoveAgent(sessionState.SpaceReservationAgent); Debug.Assert(sessionState.SpaceReservationAgent == null); var presenter = session.Presenter; var popupPresenter = presenter as IPopupIntellisensePresenter; if (popupPresenter != null) { if (sessionState.SpaceReservationManager == null) { sessionState.SetSpaceReservationManager(wpfTextView.GetSpaceReservationManager(popupPresenter.SpaceReservationManagerName)); sessionState.SpaceReservationManager.AgentChanged += SpaceReservationManager_AgentChanged; } UnregisterPopupIntellisensePresenterEvents(sessionState.PopupIntellisensePresenter); sessionState.PopupIntellisensePresenter = popupPresenter; RegisterPopupIntellisensePresenterEvents(sessionState.PopupIntellisensePresenter); var presentationSpan = popupPresenter.PresentationSpan; var surfaceElement = popupPresenter.SurfaceElement; if (presentationSpan != null && surfaceElement != null) { sessionState.SpaceReservationAgent = sessionState.SpaceReservationManager.CreatePopupAgent(presentationSpan, popupPresenter.PopupStyles, surfaceElement); sessionState.SpaceReservationManager.AddAgent(sessionState.SpaceReservationAgent); } } else { var customPresenter = presenter as ICustomIntellisensePresenter; if (customPresenter != null) customPresenter.Render(); else Debug.Assert(presenter == null, $"Unsupported presenter: {presenter?.GetType()}"); } }
SessionState GetSessionState(IIntellisenseSession session) { int index = GetSessionStateIndex(session); if (index >= 0) return sessionStates[index]; var sessionState = new SessionState(session); sessionStates.Add(sessionState); return sessionState; }
int GetSessionStateIndex(IIntellisenseSession session) { for (int i = 0; i < sessionStates.Count; i++) { if (sessionStates[i].Session == session) return i; } return -1; }
public SimpleCompletionEntry(string text, StandardGlyphGroup glyph, IIntellisenseSession session) : this(text, null, glyph, session) { }
public SimpleCompletionEntry(string text, IIntellisenseSession session) : this(text, null, session) { }
public SimpleCompletionEntry(string text, string description, StandardGlyphGroup glyph, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, GlyphService.GetGlyph(glyph, StandardGlyphItem.GlyphItemPublic), null, false, session as ICompletionSession) { }
public SimpleCompletionEntry(string text, string description, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, _glyph, null, false, session as ICompletionSession) { }
public SimpleCompletionEntry(string text, string insertionText, ImageSource glyph, IIntellisenseSession session) : base(text, "\"" + insertionText + "\"", null, glyph ?? _glyph, null, false, session as ICompletionSession) { }
public void PushSession(IIntellisenseSession session) { if (wpfTextView.IsClosed) throw new InvalidOperationException(); if (session == null) throw new ArgumentNullException(nameof(session)); if (sessions.Contains(session)) throw new InvalidOperationException(); if (sessions.Count == 0) commandTargetFilter.HookKeyboard(); sessions.Insert(0, session); session.Dismissed += Session_Dismissed; session.PresenterChanged += Session_PresenterChanged; PresenterUpdated(session); }
public SimpleCompletionEntry(string text, StandardGlyphGroup glyph, IIntellisenseSession session) : this(text, null, glyph, session) { }
public static void ClearCompleteWordMode(this IIntellisenseSession session) => session.Properties.RemoveProperty(CompleteWord);
public SimpleCompletionEntry(string text, string description, StandardGlyphGroup glyph, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, GlyphService.GetGlyph(glyph, StandardGlyphItem.GlyphItemPublic), null, false, session as ICompletionSession) { }
public static void SetTriggerCharacter(this IIntellisenseSession session, char triggerChar) => session.Properties[TriggerChar] = triggerChar;
public SessionState(IIntellisenseSession session) => Session = session;
TryCreateIntellisensePresenter(IIntellisenseSession session) { // returning null will // trigger the default Intellisense provider return(null); }
public NpmVersionCompletionEntry(string text, string description, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, Constants.Icon, null, false, session as ICompletionSession) { }
public SimpleCompletionEntry(string text, ImageSource glyph, IIntellisenseSession session) : this(text, null, glyph, session) { }
public void HACK_StartCompletionSession(IIntellisenseSession editorSessionOpt) { HACK_SetShimCompletionSession(); editorSessionOpt.Dismissed += CompletionOrSignatureHelpSession_Dismissed; }
internal static Collection <ITextBuffer> GetBuffersForTriggerPoint(IIntellisenseSession session) { return(session.TextView.BufferGraph.GetTextBuffers( buffer => session.GetTriggerPoint(buffer) != null)); }
public static void SetCompleteWordMode(this IIntellisenseSession session) => session.Properties[CompleteWord] = true;
public SimpleCompletionEntry(string text, string insertionText, ImageSource glyph, IIntellisenseSession session) : base(text, "\"" + insertionText + "\"", null, glyph ?? _glyph, null, false, session as ICompletionSession) { }
public static bool IsCompleteWordMode(this IIntellisenseSession session) => session.Properties.TryGetProperty(CompleteWord, out bool prop) && prop;
public static bool IsSupportedSession(IIntellisenseSession session) => session is ICompletionSession || session is ISignatureHelpSession;
public static char GetTriggerCharacter(this IIntellisenseSession session) => session.Properties.TryGetProperty(TriggerChar, out char c) ? c : '\0';
public BowerNameCompletionEntry(string text, IIntellisenseSession session, DTE2 dte, JSONDocument doc) : base(text, "\"" + text + "\"", null, Constants.Icon, null, false, session as ICompletionSession) { _dte = dte; _doc = doc; }
public BowerNameCompletionEntry(string text, IIntellisenseSession session, JSONDocument doc) : base(text, "\"" + text + "\"", null, Constants.Icon, null, false, session as ICompletionSession) { _doc = doc; }
public void MoveSessionToTop(IIntellisenseSession session) { if (!_stack.Remove(session)) { throw new InvalidOperationException(); } PushSession(session); }
public SimpleCompletionEntry(string text, ImageMoniker moniker, IIntellisenseSession session, int specificVersion) : this(text, null, WpfUtil.GetIconForImageMoniker(moniker, 16, 16), session) { _specificVersion = specificVersion; }
public void PushSession(IIntellisenseSession session) { session.Dismissed += session_Dismissed; _stack.Add(session); }
public SimpleCompletionEntry(string text, string description, ImageMoniker moniker, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, WpfUtil.GetIconForImageMoniker(moniker, 16, 16), null, false, session as ICompletionSession) { }
public VersionCompletionEntry(string displayText, string insertionText, string description, ImageMoniker moniker, ITrackingSpan span, IIntellisenseSession session, int specificVersion) : base(displayText, insertionText, description, moniker, span, session, specificVersion) { if (!string.IsNullOrEmpty(displayText)) { SemVersion = SemanticVersion.Parse(displayText); } }
public SimpleCompletionEntry(string text, IIntellisenseSession session) : this(text, null, session) { }
/// <summary> /// Returns the span to use for the provided intellisense session. /// </summary> /// <returns>A tracking span. The span may be of length zero if there /// is no suitable token at the trigger point.</returns> internal static ITrackingSpan GetApplicableSpan(IIntellisenseSession session, ITextBuffer buffer) { var snapshot = buffer.CurrentSnapshot; var triggerPoint = session.GetTriggerPoint(buffer); var span = GetApplicableSpan(snapshot, triggerPoint); if (span != null) { return span; } return snapshot.CreateTrackingSpan(triggerPoint.GetPosition(snapshot), 0, SpanTrackingMode.EdgeInclusive); }
public SimpleCompletionEntry(string text, string description, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, _glyph, null, false, session as ICompletionSession) { }
public NpmVersionCompletionEntry(string text, string description, IIntellisenseSession session, DTE2 dte) : base(text, "\"" + text + "\"", description, Constants.Icon, null, false, session as ICompletionSession) { _dte = dte; }
public SimpleCompletionEntry(string displayText, string insertionText, string description, IIntellisenseSession session) : base(displayText, insertionText, description, _glyph, null, false, session as ICompletionSession) { }
public void HACK_StartCompletionSession(IIntellisenseSession editorSessionOpt) { HACK_SetShimCompletionSession(); editorSessionOpt.Dismissed += CompletionOrSignatureHelpSession_Dismissed; }