Skip to content

Features

oyse edited this page Sep 9, 2014 · 2 revisions

Syntax highlighting

YEdit performs syntax highlighting as you type. Some syntax highlighting is also done after you have been idle for some time. The time to wait can be configured in the YEdit preferences under "Seconds between syntax reevalution".

YEdit recognizes the following syntactic elements:

  • Comments
  • Keys
  • Scalars
  • Constants
  • Anchors
  • Aliases
  • Tags
  • Document end and document start

You can set the color and text style of all of these elements as you prefer.

Syntax checking

Each time you save a document YEdit will perform a syntax check using the SnakeYAML YAML parser.

The syntax checker will only mark the first error it encounters in a YAML document. This will be marked with an error marker in the left margin and also in the problems that and on the file. The error message from SnakeYAML will be shown if you hover the mouse over the error marker.

Content outline

Each time you save a file a document outline will be created by parsing the file using SnakeYAML. The outline view will show the basic structure of the file.

By default the outline view will show the the explicit or implicit tags for each element. This can be useful, but can also cause the outline view to become cluttered. You can turn of this in the YEdit preferences by unchecking "Show tags in outline view". The outline will also cut long scalars to prevent it from becoming unreadable. You can adjust the number of characters show in "Maximum display length of scalar".

Templates

YEdit support standard Eclipse templates without any extra special template variables.

Auto-indenting

YEdit supports out-indenting and auto-dedenting with the Tab and Shift-Tab. It will also start new lines at the same indent as the previous line.

Toggling comments

YEdit supports toggling comments. Comments will be removed for the selected lines if the first non-blank character on each line is '#'. Otherwise '#' will be added to the start of each line.

Symfony compatibility mode

This feature depends on a useful hack. User that do not edit Symfony configuration files should not enable this.

Configuration files for the Symfony PHP framework can contain special variables that start with % or %%. This is not allowed according to the YAML spec and SnakeYAML reports any scalars that start with % or %% as an error and an outline cannot be created. To work around this problem you can enable "Symfony compatibility mode" in the preferences.

When this mode is enable '%' characters in unquoted scalars will be replaced with '_' before the file content is passed to SnakeYAML. In this way SnakeYAML will not report any syntax errors and a content outline can be created. Note that this does not change the actual file, only what the parser sees.

To get this to work the parser used by the syntax highlighter is used to detect scalars. This parser is severely limited and in no way as good as the SnakeYAML parser. This means that the parser can fail to detect a scalar or incorrectly detect a scalar. In that case this feature will fail.

Please report any problems that you have with this feature.

Thanks to kraven@kraven.org for reporting this issue and helping me with finding an acceptable solution.

Source formatting (experimental)

YEdit supports basic formatting of source files. The source formatter should make it easier to keep a consistent scalar and structure style.

This feature is new and feedback is welcome.

Clone this wiki locally