Tips and Tricks
This section contains advanced information that will help you get the most out of SysIDE Editor by using functionality provided by the editor you are using - Visual Studio Code, Cursor or VSCodium.
Learn about:
Code Snippets - Create reusable templates
Multi-cursor Editing - Edit multiple lines at the same time
Code Snippets
Code snippets let you create reusable templates for frequently used model patterns. They are especially useful when creating multiple similar elements with different attributes.
Here is a practical example:
part def Vehicle {
attribute Make;
attribute Model;
attribute Horsepower;
}
To create a snippet for vehicle instances:
Create a .vscode folder in your project (even if you are using an alternative like Cursor)
Add a example_snippets.code-snippets file with this template:
{
"Vehicle instance": {
"scope": "sysml",
"prefix": "new_vehicle",
"body": [
"part $1 : Vehicle {",
" :>> Make = \"$2\";",
" :>> Model = \"$3\";",
" :>> Horsepower = \"$4\";",
"}"
],
"description": "Create a new vehicle instance"
}
}
Explanation of the fields:
scope
: Language where the snippet works (sysml
)prefix
: Text to type to trigger the snippet (new_vehicle
)body
: Template with$n
placeholders for customizationdescription
: Help text shown in autocomplete
To use the snippet:
Type
new_vehicle
in any.sysml
filePress Tab to insert the template
Use Tab to jump between fields (
$1
to$4
)
Snippets can be also shared with your team by committing the .code-snippets
file to
your repository.
Learn more about code snippets in the VS Code documentation.
Note
Depending on the editor you are using, the Tab key might be used for a different autocomplete feature. You can customize the keybindings by opening command palette (Ctrl+Shift+P for Windows/Linux, Command+Shift+P for MacOS) and typing “Preferences: Open Keyboard Shortcuts”.
Multi-cursor Editing
VS Code (and compatible editors) can speed up model editing by letting you edit multiple lines at once using its multi-cursor functionality.
This is especially useful in scenarios like the following: suppose you have a list of
parts created without a part def
defined, for example:
part Part1;
part Part22;
part Part333;
Later, you decide to assign all these parts to a new type, such as part def
GenericPart
. You could:
Type
: GenericPart
afterPart1
, select and copy it, then paste it after each part.Or, use multiple cursors to insert
: GenericPart
at all the required locations simultaneously.
The second approach is much faster and can be done in several ways:
Hold Alt (Option`) and click at each location where you want to add a cursor.
Use the keyboard shortcut Alt+Ctrl+↑/↓ for Windows/Linux, Option+Cmd+↑/↓ for MacOS to add cursors above or below the current line.
Select a piece of text (like
part
or;
), then press Ctrl+D for Windows/Linux, Cmd+D for MacOS to select and place a cursor at the next occurrence of that text. Repeat to select more instances.
Multi-cursor editing can save significant time when making the same change in multiple places.