Skip to content

Commit

Permalink
feat: Add support for the Ink programming language (#12773)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhizoome authored Feb 12, 2025
1 parent 5a66270 commit 258e3e1
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
| idris | | | | `idris2-lsp` |
| iex || | | |
| ini || | | |
| ink || | | |
| inko |||| |
| janet || | | |
| java |||| `jdtls` |
Expand Down
14 changes: 14 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4174,3 +4174,17 @@ language-servers = [ "yls" ]
[[grammar]]
name = "yara"
source = { git = "https://github.com/egibs/tree-sitter-yara", rev = "eb3ede203275c38000177f72ec0f9965312806ef" }

[[language]]
name = "ink"
scope = "source.ink"
file-types = ["ink"]
injection-regex = "ink"
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/"}
indent = { tab-width = 4, unit = "\t" }
soft-wrap = { enable = true }

[[grammar]]
name = "ink"
source = { git = "https://github.com/rhizoome/tree-sitter-ink", rev = "8486e9b1627b0bc6b2deb9ee8102277a7c1281ac" }
53 changes: 53 additions & 0 deletions runtime/queries/ink/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
; tags and labels
(label) @label
(tag (identifier) @commment)
(tag) @comment

; values
(identifier) @function
(string) @string
(boolean) @constant
(number) @constant.numeric

; headers
(knot_header) @keyword
(stitch_header) @keyword
(function_header) @keyword

; marks (ink)
(option_mark) @keyword.directive
(gather_mark) @type.builtin
(glue) @type.builtin

; calls
(divert_or_thread) @function

; operators
(assignment) @operator

; special marks/operators (ink)
(arrow) @special
(double_arrow) @special
(back_arrow) @constant
(dot) @special
(mark_start) @special
(mark_end) @special
(hide_start) @special
(hide_end) @special

; declarations
(var_line) @attribute
(const_line) @constant
(list_line) @type

; comments
(line_comment) @comment
(block_comment) @comment

; unparsed code
(inline_block) @keyword
(condition_block) @keyword
(code_text) @keyword

; support injection
(program) @ui.text

0 comments on commit 258e3e1

Please sign in to comment.