You can use any text editor for editing Art files, but it's highly recommended to edit them in Code RealTime. Thereby you will have access to features such as syntax coloring, content assist and semantic validation.
Code RealTime provides color themes that have been specifically designed for being used for editing Art files. Activate one of these color themes from File - Preferences - Color Theme.
This feature, which also is known as IntelliSense or Code Completion, helps you when editing an Art file by proposing commonly used Art constructs that are valid at the current cursor position. Invoke Content Assist by pressing Ctrl+Space. Depending on where the cursor is placed you will get different proposals to choose from. There are four kinds of proposals as shown in the picture below:
State
variable for the capsule code template which occurs both in the state definition and as a state reference in the initial transition. All occurrances of a variable are updated simultaneously when you replace the variable with a string.Note that code templates are also available in some C++ code snippets (e.g. rt::decl
and rt::impl
) and can help you insert pieces of C++ code that are commonly used in Art applications.
name
item in the proposals list tells you that you can use an arbitrary identifier as the name of an Art element at that position. For example, in the proposals list shown in the picture above name
appears since a triggered transition may have an optional name before its declaration. The code template for the triggered transition will not insert a name, since many transitions don't have names, but you can manually add it afterwards:MyTransition: State -> X on timer.timeout
:
or .
where applicable. For example, after you have typed the name for the triggered transition shown above you can use Content Assist to learn that it may be followed by either a ->
or :
token:If you use Content Assist within a C++ code snippet, Code RealTime will delegate the request to the C++ language server extension that is installed. It works by computing valid completions from the cursor position based on the generated C++ file that contains the code from the code snippet.
Note that the "Microsoft C++" and "clangd" language servers work slightly differently in this regard. It can happen that you in some cases need to invoke Content Assist twice, before the correct results appear. This has to do with how the language servers keep cached information from C++ files, and will hopefully improve in future versions.
Hint
The "clangd" language server supports an argument --completion-parse=always
which you can add in its settings. It's recommended to set this argument, since it will force the generated C++ file to be parsed each time Content Assist is invoked, without relying on cached information.
To rename an Art element place the cursor on the element's name and press F2 (or invoke the command Rename Symbol from the context menu). This performs a "rename refactoring" that updates all references to the renamed element too.
Note
Avoid renaming an element by simply editing its name. For Code RealTime to understand that you want to rename an element, rather than replacing it with another element, you need to use the approach described above.