Some questions related with SyntaxEditor

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 16 years ago by BorodaAlex
Version: 4.0.0275
Avatar
1) Does SyntaxEditor have ability for Automatic formatting C# code ?
I made the following settings for language of document :

        editor.Document.Language = new CSharpSyntaxLanguage();
    
then I try to format document in the following way:

        editor.Document.Language.FormatDocument(editor.Document);
    
And get error:
"The language 'C#' needs to implement the 'FormatTextRange' method so that it can support code formatting."

What should I tune to achieve Automatic formatting for C#?

2) Issue with Generic IntelliSense via Ctrl+Space:
Is there a way to display Generic variables types correctly? Generic variable should contain name of type. Now I see that prompt for generic variable contains defenition like this: 'IList<T> myCollection', but should contain 'IList<MyType> myCollection'.
I am not able to display the methods and Properties of elements of my generics collection:

         myCollection[0]. //<-Does not contain the corresponding members of MyType.
        
3) I need to show Intellisense dialog when the user types 'Tab' in the code editing area like it is shown by Ctrl+Space.
I am doing that like this:

 CommandLink newTabCommandLink = null;
            for (int index = editor.CommandLinks.Count - 1; index >= 0; index--)
            {
                CommandLink commandLink = editor.CommandLinks[index];
                if ((commandLink.KeyBinding.Modifiers == ActiproSoftware.WinUICore.Input.ModifierKeys.Control) &&
                    (commandLink.KeyBinding.Key == Keys.Space))
                {
                    newTabCommandLink = commandLink;
                }

                //remove the old command related with 'Tab' button.
                if ((commandLink.KeyBinding.Modifiers == ActiproSoftware.WinUICore.Input.ModifierKeys.None) &&
                    (commandLink.KeyBinding.Key == Keys.Tab))
                {
                    editor.CommandLinks.RemoveAt(index);
                }

            }

            // Bind the command on pressing 'Tab' button.
            if (newTabCommandLink != null && newTabCommandLink.Command != null)
            {
                editor.CommandLinks.Add(
                    new CommandLink(newTabCommandLink.Command,
                                    new KeyBinding(ActiproSoftware.WinUICore.Input.ModifierKeys.None, Keys.Tab)));
            }
It works. But it is still needed to insert 'tab' area after typing 'Tab' button.
As far as I understood it's not possible to have two commands bound on the one combinations of keys, so I have to delete predefined tab command. How can I insert tab area and show Intellisense dialog in this case?

Comments (3)

Posted 16 years ago by BorodaAlex
Avatar
The product version I use is SyntaxEditor .NET Languages Add-on v4.0.243
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
1) We don't have code written to format C# at this time. You can inherit our CSharpSyntaxLanguage class and override the FormatTextRange method to add your own formatting logic if you'd like though.

2) While we still are working in enhancing IntelliPrompt, the latest builds should have member lists showing the members of generic collection items. You mentioned you have an older build so that may not yet have had the feature.

3) Maybe instead of that, keep the default command in place and handle the KeyTyped event and look for the Tab there. That fires after the command so you can kick off your Ctrl+Space-like logic then.


Actipro Software Support

Posted 16 years ago by BorodaAlex
Avatar
Thanks for your quickly answering my question.
The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.