Example #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);
            }
        }
Example #2
0
        private ScopeInfo GetScopeInfo()
        {
            string oldText = _evaluatable.Text;

            _evaluatable.Text = String.Empty;
            try
            {
                ScopeInfoBuilder builder = new ScopeInfoBuilder();

                ICodeAssistanceContextProvider codeAssistanceContextProvider = _evaluatable.GetCodeAssistanceContextProvider();
                IMemberCompletionContext       context = codeAssistanceContextProvider.ProvideMemberCompletionContext(SourceLocation.Empty);
                context.Enumerate(builder);

                return(builder.GetScopeInfo());
            }
            finally
            {
                _evaluatable.Text = oldText;
            }
        }