IntelliPrompt not working in release version

SyntaxEditor for WPF Forum

Posted 15 years ago by Bradley
Avatar
I had download the evaluation of WPF Studio and had gotten SyntaxEditor to work in my code, including the IntelliPrompt stuff. We purchased the release version and after I set the references to the new stuff everything works except the IntelliPrompt. I can put the code for it in a button and it will show up when clicked, but ctrl+space isn't bringing it up like it was in the evaluation code. The code is taken directly from the sample:

Inside constructor:

CommandManager.RegisterClassCommandBinding(typeof(EditorWindow), new CommandBinding(EditorCommands.IntelliPromptCompleteWord, OnIntelliPromptCompleteWordExecuted));
Everything else:

       /// <summary>
        /// Occurs when the <see cref="RoutedCommand"/> is executed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">An <see cref="ExecutedRoutedEventArgs"/> that contains the event data.</param>
        private static void OnIntelliPromptCompleteWordExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorWindow control = sender as EditorWindow;
            control.ShowCompletionList(true);
        }

        private void ShowCompletionList(bool allowAutoComplete)
        {
            //
            // IMPORTANT NOTE:
            // The items for this completion list are hardcoded in this sample and
            // are simply meant to illustrate the rich features of the SyntaxEditor completion list.
            // When implementing a real language, you should vary the items based
            // on the current context of the caret.
            //

            // Create a session
            CompletionSession session = new CompletionSession();
            session.CanCommitWithoutPopup = allowAutoComplete;
            session.MatchOptions = CompletionMatchOptions.TargetsDisplayText;

            // HTML allows ! and - characters to be typed too... make sure they are inserted
            session.AllowedCharacters.Add('!');
            session.AllowedCharacters.Add('-');

            // Add some items
            session.Items.Add(new CompletionItem("!--", new CommonImageSourceProvider(CommonImage.XmlComment),
                new HtmlQuickInfoContentProvider("<b>&lt;!-- --&gt;</b> Comment<br/><span style=\"color: #008000;\">A comment.</span>"),
                "<!-- ", " -->"));
            session.Items.Add(new CompletionItem("a", new CommonImageSourceProvider(CommonImage.XmlTag),
                new HtmlQuickInfoContentProvider("<b>a</b> Element<br/><span style=\"color: #008000;\">A hyperlink to another URL.</span>"),
                "<a href=\"", "\""));
            session.Items.Add(new CompletionItem("br", new CommonImageSourceProvider(CommonImage.XmlTag),
                new HtmlQuickInfoContentProvider("<b>br</b> Element<br/><span style=\"color: #008000;\">Creates a line break.</span>"),
                "<br/>", null));

            // Open the session
            session.Open(TextEditor.ActiveView, new TextRange(TextEditor.ActiveView.Selection.EndOffset));
        }
You'll notice it is exactly what's in the sample browser code, which does work as intended. Any ideas would be appreciated, thanks.

Comments (2)

Posted 15 years ago by Bradley
Avatar
Doh! Should have waited 5 minutes to post that question :-P

Not sure why it worked before but not now (and it works in the button like its supposed to), but apparently it needs this code before the RegisterClass... method
            for (int index = TextEditor.CommandBindings.Count - 1; index >= 0; index--)
            {
                if (TextEditor.CommandBindings[index].Command == EditorCommands.IntelliPromptCompleteWord)
                    TextEditor.CommandBindings.RemoveAt(index);
            }
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bradley,

That particular command is handled by SyntaxEditor itself so that's why it won't bubble up normally. BTW, it's being renamed to RequestIntelliPromptCompletionSession in the next build.

In the next build, we've already done a ton of work on completion list handling so it is now possible to handle keypresses like ".", "<" or even Ctrl+Space completely from within a language definition instead of externally like in that sample. We hope to have the next build out within the next couple weeks.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.