diff options
| author | Théo Reichel <390145+theoo@users.noreply.github.com> | 2025-01-21 09:25:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-21 09:25:08 +0100 |
| commit | 1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1 (patch) | |
| tree | fcd3b9db4b2a3fefa8a63d94e3e0c3fb764458f2 | |
| parent | bot(lockfile): update erlang, hyprlang, solidity, t32 (diff) | |
| download | nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.tar nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.tar.gz nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.tar.bz2 nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.tar.lz nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.tar.xz nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.tar.zst nvim-treesitter-1c67567464b0b01d2f8ccd4237d9ecbb3eb2dff1.zip | |
feat(slim): add parser and queries (#7425)
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/slim/folds.scm | 1 | ||||
| -rw-r--r-- | queries/slim/highlights.scm | 82 | ||||
| -rw-r--r-- | queries/slim/indents.scm | 4 | ||||
| -rw-r--r-- | queries/slim/injections.scm | 39 | ||||
| -rw-r--r-- | queries/slim/locals.scm | 7 |
7 files changed, 144 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json index 12cabd059..ed79c1585 100644 --- a/lockfile.json +++ b/lockfile.json @@ -704,6 +704,9 @@ "slang": { "revision": "3ed23c04a412a0559162d9cadf96dfff7cb36079" }, + "slim": { + "revision": "23c9917c649659ae8ddf6d88fb9e9c6cfd80b8e0" + }, "slint": { "revision": "f11da7e62051ba8b9d4faa299c26de8aeedfc1cd" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 61c0505b7..ca2fb11b0 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2042,6 +2042,14 @@ list.slang = { experimental = true, } +list.slim = { + install_info = { + url = "https://github.com/theoo/tree-sitter-slim", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@theoo" }, +} + list.slint = { install_info = { url = "https://github.com/slint-ui/tree-sitter-slint", diff --git a/queries/slim/folds.scm b/queries/slim/folds.scm new file mode 100644 index 000000000..aabc67617 --- /dev/null +++ b/queries/slim/folds.scm @@ -0,0 +1 @@ +(child) @fold diff --git a/queries/slim/highlights.scm b/queries/slim/highlights.scm new file mode 100644 index 000000000..e219932f6 --- /dev/null +++ b/queries/slim/highlights.scm @@ -0,0 +1,82 @@ +(comment) @comment @spell + +(tag_id) @keyword.function + +(tag_class) @keyword.type + +(injector) @keyword.import + +(directive_sign) @keyword.directive + +[ + (string_start) + (string_content) + (string_end) +] @string + +(bracket) @punctuation.bracket + +[ + "#{" + "}" +] @punctuation.special + +(delimiter) @tag.delimiter + +(parameter_name) @variable.parameter + +(parameter_value) @tag.attribute + +[ + (text_inline) + (text_block) +] @markup.raw.block + +; Markup tags +; https://developer.mozilla.org/en-US/docs/Web/HTML/Element +(tag_name) @tag + +((tag_name) @tag.builtin + (#any-of? @tag.builtin + "doctype" "html" "head" "title" "base" "link" "meta" "style" "body" "article" "section" "nav" + "aside" "hgroup" "footer" "address" "p" "hr" "pre" "blockquote" "menu" "figure" "figcaption" + "main" "div" "small" "s" "cite" "q" "dfn" "abbr" "rt" "rp" "data" "time" "code" "var" "samp" + "kbd" "sub" "sup" "u" "mark" "bdi" "bdo" "span" "br" "wbr" "ins" "del" "picture" "source" "img" + "iframe" "embed" "object" "param" "video" "audio" "track" "map" "area" "table" "caption" + "colgroup" "col" "tbody" "thead" "tfoot" "tr" "td" "th" "form" "label" "input" "button" "select" + "datalist" "optgroup" "option" "textarea" "output" "progress" "meter" "fieldset" "legend" + "details" "summary" "dialog" "script" "noscript" "template" "slot" "canvas")) + +((tag_name) @markup.strong + (#any-of? @markup.strong "b" "strong")) + +((tag_name) @markup.italic + (#any-of? @markup.italic "i" "em")) + +((tag_name) @markup.link + (#any-of? @markup.link "a")) + +; Headings +((tag_name) @markup.heading + (#any-of? @markup.heading "header")) + +((tag_name) @markup.heading.1 + (#any-of? @markup.heading.1 "h1")) + +((tag_name) @markup.heading.2 + (#any-of? @markup.heading.2 "h2")) + +((tag_name) @markup.heading.3 + (#any-of? @markup.heading.3 "h3")) + +((tag_name) @markup.heading.4 + (#any-of? @markup.heading.4 "h4")) + +((tag_name) @markup.heading.5 + (#any-of? @markup.heading.5 "h5")) + +((tag_name) @markup.heading.6 + (#any-of? @markup.heading.6 "h6")) + +((tag_name) @markup.list + (#any-of? @markup.list "ul" "ol" "li" "dl" "dt" "dd")) diff --git a/queries/slim/indents.scm b/queries/slim/indents.scm new file mode 100644 index 000000000..a06a75867 --- /dev/null +++ b/queries/slim/indents.scm @@ -0,0 +1,4 @@ +(tag) @indent.begin + +((tag) @indent.zero + (#any-of? @indent.zero "doctype" "html")) diff --git a/queries/slim/injections.scm b/queries/slim/injections.scm new file mode 100644 index 000000000..3bee13931 --- /dev/null +++ b/queries/slim/injections.scm @@ -0,0 +1,39 @@ +((ruby_inline) @injection.content + (#set! injection.language "ruby")) + +((ruby_lang) @injection.content + (#set! injection.language "ruby") + (#set! injection.combined)) + +((javascript_lang) @injection.content + (#set! injection.language "javascript") + (#set! injection.combined)) + +((css_lang) @injection.content + (#set! injection.language "css") + (#set! injection.combined)) + +((sass_lang) @injection.content + (#set! injection.language "sass") + (#set! injection.combined)) + +((scss_lang) @injection.content + (#set! injection.language "scss") + (#set! injection.combined)) + +((less_lang) @injection.content + (#set! injection.language "less") + (#set! injection.combined)) + +((scss_lang) @injection.content + (#set! injection.language "scss") + (#set! injection.combined)) + +((markdown_lang) @injection.content + (#set! injection.language "markdown")) + +((rdoc_lang) @injection.content + (#set! injection.language "rdoc")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/slim/locals.scm b/queries/slim/locals.scm new file mode 100644 index 000000000..e9f0b0079 --- /dev/null +++ b/queries/slim/locals.scm @@ -0,0 +1,7 @@ +(child) @local.scope + +(tag_name) @local.definition.function + +(tag_class) @local.definition.parameter + +(tag_id) @local.definition.constant |
