A Sublime Text 4 syntax highlighting package for the KDL cuddly document language
This package adds support for the KDL
document language (for files with .kdl
extension)
-
Via Package Control: open
Command Palette
→Package Control: Install Package
→kdl
^Ctrl/⌘Cmd⇧ShiftP -
Manually: clone this repository to your Packages directory and rename it to
kdl
cd /path/to/sublime/packages/directory
git clone https://github.com/eugenesvk/sublime-kdl.git
mv sublime-kdl KDL
- Your color scheme likely needs to be patched to ignore or take full advantages of the /-slashdashed comment blocks:
Patched examples used for the screenshots below: solarized, default- to style /-slashdashed elements with muted colors:
- add
-comment
to your scopes, e.g.,{"name":"Tag name","foreground":"var(blue6)","scope":"entity.name.tag -comment"},
- add a copy of the same rule with an extra
comment
scope and a blending color function, e.g.,{"name":"Tag name C","foreground":"color(var(blue6) blend(#000 60% hsl))","scope":"entity.name.tag comment"},
- add
- to style /-slashdashed elements like regular comments add
comment.line.slash-dash.kdl
scope to your Comment rule (e.g.,{"name":"Comment","foreground":"black","scope":"comment, comment.line.slash-dash.kdl"},
) so that its 4 level specificity overrides other rules likeentity.other.attribute-name
- to style /-slashdashed elements with muted colors:
Open any kdl
file (e.g., syntax_example_screen.kdl) and verify that the selected syntax is KDL
and KDL-specific contexts are properly scoped1 and highlighted, maybe like so (depending on your color scheme):
See a list of scope names in Scope.md
This plugin adds two keybindings for the kdl
scope: "
/'
that auto-pair double/single quotes even after string modifiers
Add "kdl.keybind_disable":true
to your Preferences.sublime-settings
to disable
- Only works in Sublime Text 4 since build 4075 (10 July 2020) since it's using version 2 of the syntax
- KDL v2
"""
multiline string"""
dedent feature isn't supported, think it's impossible with the ST's syntax engine to use a later match ofspaces before the last """
in all earlier indentation matches
The default packages' syntax files (Python, Bash, PHP), as well as fish and vscode-kdl
Footnotes
-
scope naming is supposed to conform to ST's scope naming guidelines ↩