Ejemplo n.º 1
0
        private void ShowMemberListPopup(bool autoComplete)
        {
            IntelliPromptMemberList memberList = _syntaxEditor.IntelliPrompt.MemberList;

            memberList.Clear();
            memberList.ImageList = memberImageList;
            memberList.Sorted    = false;

            try
            {
                _evaluatable.Text = _syntaxEditor.Text;

                ICodeAssistanceContextProvider codeAssistanceContextProvider = _evaluatable.GetCodeAssistanceContextProvider();
                IMemberCompletionContext       completionContext             = codeAssistanceContextProvider.ProvideMemberCompletionContext(CurrentLocation);

                MemberAcceptor acceptor = new MemberAcceptor(memberList);
                completionContext.Enumerate(acceptor);
                acceptor.FlushBuffer();

                if (memberList.Count > 0)
                {
                    memberList.Sorted = true;

                    if (completionContext.RemainingPart == null)
                    {
                        memberList.Show(_syntaxEditor.Caret.Offset, 0);
                    }
                    else
                    {
                        IToken t         = _syntaxEditor.SelectedView.GetCurrentToken();
                        string tokenText = _syntaxEditor.Document.GetTokenText(t);

                        string remainingText = completionContext.RemainingPart.Text.ToUpper(CultureInfo.InvariantCulture);
                        if (t.StartOffset >= _syntaxEditor.Text.Length || !tokenText.ToUpper(CultureInfo.InvariantCulture).StartsWith(remainingText, StringComparison.OrdinalIgnoreCase))
                        {
                            t = _syntaxEditor.SelectedView.GetPreviousToken();
                        }

                        if (t != null)
                        {
                            if (autoComplete)
                            {
                                memberList.CompleteWord(t.StartOffset, t.Length);
                            }
                            else
                            {
                                memberList.Show(t.StartOffset, t.Length);
                            }
                        }
                    }
                }
            }
            catch (NQueryException ex)
            {
                ShowErrorQuickInfo(ex);
            }
        }
Ejemplo n.º 2
0
		private void ShowMemberListPopup(bool autoComplete)
		{
			IntelliPromptMemberList memberList = _syntaxEditor.IntelliPrompt.MemberList;
			memberList.Clear();
			memberList.ImageList = memberImageList;
			memberList.Sorted = false;

			try
			{
				_evaluatable.Text = _syntaxEditor.Text;

				ICodeAssistanceContextProvider codeAssistanceContextProvider = _evaluatable.GetCodeAssistanceContextProvider();
				IMemberCompletionContext completionContext = codeAssistanceContextProvider.ProvideMemberCompletionContext(CurrentLocation);

				MemberAcceptor acceptor = new MemberAcceptor(memberList);
				completionContext.Enumerate(acceptor);
				acceptor.FlushBuffer();

				if (memberList.Count > 0)
				{
					memberList.Sorted = true;

					if (completionContext.RemainingPart == null)
					{
						memberList.Show(_syntaxEditor.Caret.Offset, 0);
					}
					else
					{
						IToken t = _syntaxEditor.SelectedView.GetCurrentToken();
						string tokenText = _syntaxEditor.Document.GetTokenText(t);

						string remainingText = completionContext.RemainingPart.Text.ToUpper(CultureInfo.InvariantCulture);
						if (t.StartOffset >= _syntaxEditor.Text.Length || !tokenText.ToUpper(CultureInfo.InvariantCulture).StartsWith(remainingText, StringComparison.OrdinalIgnoreCase))
							t = _syntaxEditor.SelectedView.GetPreviousToken();

						if (t != null)
						{
							if (autoComplete)
								memberList.CompleteWord(t.StartOffset, t.Length);
							else
								memberList.Show(t.StartOffset, t.Length);
						}
					}
				}
			}
			catch (NQueryException ex)
			{
				ShowErrorQuickInfo(ex);
			}
		}