Sculptor


As mentioned in the installation guide does Sculptor come with an eclipse-based text editor for Sculptors DSL:

Sculptor Text Editor

Features

This text editor is generated by Xtext from the grammar definition of Sculptors DSL. Some of the editors features (based on Xtexts IDE concepts) are described in the following chapters.

Syntax Coloring

The editor is capable to mark up your model-code to improve the overall readability:

Syntax Coloring Sample

It is possible to use different colors and fonts according to the meaning of the different parts of your input file. This is configured in the corresponding Eclipse preferences page:

Preferences Syntax Coloring

Code Formatting

Sculptors DSL editor provides a code formatter. In the editor press Ctrl+Shift+F on code to format it. If no selection is set then the entire model source is formatted otherwise only the selection will be.

Content Assist

In the DSL editor press Ctrl+Space on code to complete. This opens a list of available code completions.

Content Assist

Use the mouse or the keyboard (Up Arrow, Down Arrow, Page Up, Page Down, Home, End, Enter) to navigate and select lines in the list. Clicking or pressing Enter on a selected line in the list inserts the selection into the editor.

Outline View

The DSL editor provides a view which displays an outline of the structure of the currently-active model file in the editor area.

Outline View

This view provides tool bar buttons for activating the following features:

  • linking the outline view with the editor
  • sorting the outline tree nodes in alphabetically order

If not visible this view can be opened via Window > Show View > Outline.

Problem Markers with Quick Fixes

The DSL editor shows markers for problems (error or warning) within the model found while typing and after saving.

Problem Markers

For some types of problems the editor offers corrections. To show that correction proposals are available for a problem, a ‘light bulb’ is visible on the editor’s annotation bar.

Left click on the light bulb or invoking Ctrl+1 (Edit > Quick Fix) brings up the proposals for the problem at the cursor position. Each quick fix shows a preview when selected in the proposal window.

Problem Marker with Quick Fix

Quick fixes are also shown directly in problem hovers (but there, no preview is available).

Problem Marker with Quick Fix in Hover

Hyperlinking

The DSL editor allows navigating to the declaration of referenced model elements via hyperlinks. These hyperlinks are shown as a blue line while moving the cursor over a model reference with the Ctrl key pressed.

Hyperlink

An alternate way of navigating to the declaration of the referenced model element is by placing the cursor on the reference and pressing F3.

The DSL editor provides the following types of searches:

  • Searching for references of a selected model element (activated by placing the cursor on a model element and pressing Ctrl+Shift+G)

    Search for references

  • Searching model elements in Xtexts global index (activated by pressing Ctrl+Shift+F3)

    Search for references

Rename Refactoring

The DSL editor provides rename refactoring of a model element (activated by placing the cursor on a model element and pression Ctrl+Alt+R).

Rename refactoring

For opening the preview press Ctrl+Enter instead of Enter.

Rename refactoring

Template Proposals

The DSL editor provides template proposals in the content assist.

Template proposals

These templates can be modified (or new ones can be defined) via the corresponding preference page.

Template preferences

Caveats

Eclipse projects need Xtext Project Nature

Xtexts maintains internally a global index of all model files. This index is used for hyperlinking and refactoring.

An xtext-specific Eclipse builder is used to update the index. To enable this builder every Eclipse project with Sculptor models must have the Xtext project nature set in their project properties.

Automatic Build must be enabled

Xtexts maintains internally a global index of all model files. This index is used for hyperlinking and refactoring.

An xtext-specific Eclipse builder is used to update the index. To execute this builder automatically on resource changes the option “Project > Build automatically” must be enabled for the Eclipse workspace.

Fork me on GitHub