Skip to content
FichteFoll edited this page Mar 12, 2022 · 5 revisions

Automatic Syntax Assignment

The syntax specified in the first line of a syntax test file is assigned automatically and overrides any automatic detection from Sublime Text's side.

If the specified path does not exist in your installation, the Plain Text syntax is used.

Syntax Test Highlighting

The columns of the line tested with the currently active line are highlighted. The highlighting style can be configured in the settings.

Image showing syntax test highlighting

Syntax Test Completions

PackageDev tries to determine a scope selector to test against the specified columns. This only happens when pressing ^ on a line that does not have a syntax test already. (Also works for <-.) You can extend the matched region by pressing ^ again. The selector will be reduced to the greatest common denominator of the scopes on the selected columns.

You can press the Tab key on an empty test line to jump to the next untested column and automatically insert a scope selector.

Animation with syntax test completions

With syntax_test.suggest_asserted_prefix enabled, the above show case would not include meta.sequence.json completions for any line following the first.

Syntax Test Generation

Selecting PackageDev: Generate Syntax Tests for Line from the command palette or using Ctrl+Enter will generate syntax tests for all tokens and scope regions on the current line.

Animation of syntax test generation

Syntax Test Linting

Syntax test linting is not provided by this package, but you can use the SublimeLinter-contrib-sublime-syntax package, which uses the SublimeLinter framework and interfaces with ST's internal API.