KDL
KDL syntax highlighting for Sublime Text
Details
Installs
- Total 387
- Win 49
- Mac 83
- Linux 255
Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 0 | 0 |
Linux | 0 | 5 | 0 | 1 | 0 | 4 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 2 | 0 | 1 | 0 | 0 | 2 | 1 | 1 | 1 | 0 | 1 | 1 | 3 | 2 | 2 | 1 | 1 | 1 | 1 | 2 | 4 | 0 | 0 | 3 | 3 | 1 | 2 | 0 | 1 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
A Sublime Text 4 syntax highlighting package for the KDL cuddly document language
Introduction
This package adds support for the KDL
document language, both versions 1 and 2 (for files with .kdl
extension, but also with .kdl1
/.kdl2
if you want to force a specific version)
Install
Via Package Control: open
Command Palette
→Package Control: Install Package
→kdl
Ctrl/⌘Cmd⇧ShiftPManually: 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"},
- 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
Use
Open any kdl
file (e.g., syntax_example_screen.kdl) and verify that the selected syntax is KDL
and KDL-specific contexts are properly scoped[1] and highlighted, maybe like so (depending on your color scheme):
[1]: scope naming is supposed to conform to ST's scope naming guidelines
Exposed scopes
See a list of scope names in Scope.md
Keybindings
2 new keybindings scoped to kdl
: "
/'
auto-pair double/single quotes even after string modifiers
Disable by adding "kdl.keybind_disable":true
to your Preferences.sublime-settings
Known issues
- 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 /-kdl-version 1
or2
prefix doesn't affect ST's bottom right syntax indicator, it will still beKDL
without a version specifier due to the limitations of STAFileIcon
extension'sPlain Text (KDL)
blank syntax may override this extension's syntax file. As far as I understand, updating to the latest versions of both packages and manually deleting the plain text variant should resolve the issue.
Misc
As part of developing this syntax I've significantly reformatted the current grey blob of text that is Spec's grammar into a better structured KDL document with syntax highlighting, see Grammar2.kdl
Credits
The default packages' syntax files (Python, Bash, PHP), as well as fish and vscode-kdl