modelica-tools / atom-language-modelica

Modelica language support for the atom editor
https://atom.io/packages/language-modelica
Other
8 stars 4 forks source link

Modelica language support in Atom

Adds syntax highlighting and snippets to Modelica files in Atom.

The grammar was partially created using an automatic conversion from the Modelica grammar for Sublime Text by Boris Chumichev.

Snippets

Current code shortcuts (type given keyword + tab):

keyword description
/* for block comments
block for block
class for class block
for for a for loop block
function for function block
if for a conditional block
model for model block
package for package block
record for record block
when for a when event block
while for a while loop block

Toggling annotations

Two commands are available to toggle folding of individual annotations or all annotations:

Documentation view

The HTML documentation in a file can be shown with the toggledocview command.

Example

Here is an example showing syntax highlighting, toggling annotations, and documentation view.

language-modelica in action

Key mappings

There are no default keymappings included. Here is one suggestion:

'atom-text-editor[data-grammar="source modelica"]:not([mini])':
  'tab':          'language-modelica:toggleannotations'
  'shift-tab':    'language-modelica:toggleallannotations'
  'ctrl-shift-j': 'language-modelica:toggledocview'

toggleannotations is a "DWIM" function, meaning if the cursor is not on the first line of an annotation, the keypress passes through to the next key mapping assigned. So, when assigned to TAB as above, TAB will still normally work right for indentation and for completion of snippets and other uses.