Q: is auto-formatting (tabulation) possible?

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by Aric
Version: 4.0.0233
Avatar
Is there a feature to auto-format code? For example, the following VB.NET code would auto-format to the code below:
Private Sub Test()
If 1=1 Then
Console.WriteLine("This is a test")
End If
End Sub
After auto-formatting:
Private Sub Test()
    If 1=1 Then
        Console.WriteLine("This is a test")
    End If
End Sub

Comments (2)

Posted 17 years ago by Aric
Avatar
It looks like SmartIndent is possible with C# ... is it possible with any other language, or is that functionality limited to the language add-on pack?

Seems to me that if it is possible to syntax-highlight a language, by those same tokens, it would be possible to SmartIndent that language as well.
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes you can custom code smart indent and code formatting into the codebehind SyntaxLanguage class for any language. Check out the "Code Formatting" and "Smart Indent" topics in the "Language Definition Guide / Other Features" section of the documentation.

For our C# language in the add-on, we did the smart indent code. That works when typing an ENTER key. You set the IndentAmount of spaces to make the line indent.

Also in our C# we process on OnSyntaxEditorKeyTyped and when { or } are pressed we auto-indent those. Same thing for a couple other characters.


Actipro Software Support

The latest build of this product (v24.1.0) 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.