ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

KDL

by eugenesvk ST4

KDL syntax highlighting for Sublime Text

Details

Installs

  • Total 88
  • Win 14
  • Mac 35
  • Linux 39
Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9
Windows 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 1 1 1 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 0 0 0 0 1 0 0
Linux 0 1 1 0 0 1 2 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 0 1

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 (for files with .kdl extension)

Install

  • Via Package Control: open Command PalettePackage Control: Install Packagekdl
                                            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"},
    • 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 like entity.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

List of scope names

| KDL construct | Scope name | :———— | :———- | Entity | entity.name. tag.node¦type
entity.other.attribute-name .kdl | Elemens | meta. node¦block.child¦argument.value¦property. ¦name¦separator¦value .kdl | Mappings | meta.mapping. key¦separator¦value
punctuation.separator.key-value punctuation.section.mapping. begin¦end .kdl | Number | constant.numeric. decimal¦float¦integer. ¦binary¦octal¦hexadecimal
constant.numeric. base¦exponent¦significand¦value
punctuation.separator. decimal¦exponent¦number .kdl | String | meta.string storage.type.string string.quoted.double. ¦raw
punctuation.definition.string. begin¦end .kdl | Comment | comment.block comment.block.documentation comment. block¦line. double-slash
punctuation.definition.comment. begin¦end .kdl | Annotation | meta.annotation punctuation.separator.annotation. begin¦end .kdl | Others | constant.character. escape¦escape.unicode.16-bit-hex
constant.language. boolean¦null
keyword. other¦operator.arithmetic punctuation.separator.continuation.line punctuation.terminator.node
invalid.illegal. ¦muted¦position¦muted.position .kdl

Keybindings

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

Known issues

  • Only works in Sublime Text 4 since build 4075 (10 July 2020) since it's using version 2 of the syntax

Credits

The default packages' syntax files (Python, Bash, PHP), as well as fish and vscode-kdl