Feature Request: Expression Editor "format expression"

Hi,

not only my use of expressions has changed drastically over the last year, in pair programming with LLMs.

Could we have in the expression editor a “Format Expression”?
Like in the source code file the “Format Document”?

Maybe there is a convenient linter/formatter already at hand for the validation, that such a function could pipe through?

A shortcut would be nice, too.

@loginerror


image

Hi @cprima,

Currently, UiPath Expression Editor does not provide a built-in “Format Expression” option to automatically format expressions like we have in Visual Studio with Format Document. Because of this, when expressions become large (for example dictionaries, LINQ queries, or complex conditions), they can become difficult to read and maintain inside the editor.
As a workaround, developers can open the workflow in UiPath Studio and use the “Format Document (Ctrl + K, D)” option, which formats the underlying XAML code and improves the readability of the expressions. In practice, it is also better to avoid writing very long expressions and instead break the logic into multiple variables or Assign activities so the workflow remains cleaner and easier to maintain.
Adding a “Format Expression” capability directly in the Expression Editor would greatly improve readability and developer productivity, especially when working with complex expressions.

Happy Automation,
AJ

1 Like

Hi @cprima , thank you sharing this feedback with us. From what I understand, you would find the Format Expression functionality useful when handling generated expressions or do you use it even in such examples when you are typing in yourself a long expression to set the default value of a variable?

Many thanks,
Raluca

Most of the times I am pasting expressions from a LLM chat, and these are lacking intendation.

The .cs code gets nicely formatted, no matter what I throw into. An equivalent in the expression editor would make the code more readable.

Since I made that feature request the latest Community Version was released which does:

  • If a file you have open is modified externally, Studio detects it and reloads it automatically.

Instead of a right-click formatter hook alternatively a OnSave hook would be similarly useful.