diff options
| author | Stefan Wienert <info@stefanwienert.de> | 2021-07-10 17:36:49 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-11-30 23:40:49 +0100 |
| commit | dec2ba27a8a64ac2e3e65d961561893052e36782 (patch) | |
| tree | cda7efc6cf360d3701ddbd82545bfabda62a464a | |
| parent | Update lockfile.json (diff) | |
| download | nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.tar nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.tar.gz nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.tar.bz2 nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.tar.lz nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.tar.xz nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.tar.zst nvim-treesitter-dec2ba27a8a64ac2e3e65d961561893052e36782.zip | |
Feat: Added Pug parser with inital queries
| -rw-r--r-- | ftdetect/pug.vim | 1 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 9 | ||||
| -rw-r--r-- | queries/pug/highlights.scm | 27 | ||||
| -rw-r--r-- | queries/pug/injections.scm | 7 | ||||
| -rw-r--r-- | queries/vue/injections.scm | 9 |
5 files changed, 53 insertions, 0 deletions
diff --git a/ftdetect/pug.vim b/ftdetect/pug.vim new file mode 100644 index 000000000..3ca05c4a2 --- /dev/null +++ b/ftdetect/pug.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.pug setlocal filetype=pug diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a9dce65b2..12a86379a 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -470,6 +470,15 @@ list.glimmer = { used_by = { "html.handlebars" }, } +list.pug = { + install_info = { + url = "https://github.com/zealot128/tree-sitter-pug", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = { "@zealot128" }, + filetype = "pug", +} + list.vue = { install_info = { url = "https://github.com/ikatyang/tree-sitter-vue", diff --git a/queries/pug/highlights.scm b/queries/pug/highlights.scm new file mode 100644 index 000000000..ba57b51d7 --- /dev/null +++ b/queries/pug/highlights.scm @@ -0,0 +1,27 @@ +(comment) @comment +(tag_name) @tag +( + (tag_name) @constant.builtin + ; https://www.script-example.com/html-tag-liste + (#any-of? @constant.builtin + "head" "title" "base" "link" "meta" "style" + "body" "article" "section" "nav" "aside" "h1" "h2" "h3" "h4" "h5" "h6" "hgroup" "header" "footer" "address" + "p" "hr" "pre" "blockquote" "ol" "ul" "menu" "li" "dl" "dt" "dd" "figure" "figcaption" "main" "div" + "a" "em" "strong" "small" "s" "cite" "q" "dfn" "abbr" "ruby" "rt" "rp" "data" "time" "code" "var" "samp" "kbd" "sub" "sup" "i" "b" "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") +) +(content) @none +(quoted_attribute_value) @string +(id) @constant +(class) @constant +(attribute_name) @symbol +( + (attribute_name ) @keyword + (#match? @keyword "^(:|v-bind|v-|\\@)") +) @keyword + diff --git a/queries/pug/injections.scm b/queries/pug/injections.scm new file mode 100644 index 000000000..027744402 --- /dev/null +++ b/queries/pug/injections.scm @@ -0,0 +1,7 @@ +(javascript) @javascript + +( + (attribute_name) @_attribute_name + (quoted_attribute_value (attribute_value ) @javascript) + (#match? @_attribute_name "^(:|v-bind|v-|\\@)") +) diff --git a/queries/vue/injections.scm b/queries/vue/injections.scm index 4d372da30..346019c13 100644 --- a/queries/vue/injections.scm +++ b/queries/vue/injections.scm @@ -25,4 +25,13 @@ (quoted_attribute_value (attribute_value) @javascript))) +( + (template_element + (start_tag + (attribute + (quoted_attribute_value (attribute_value) @_lang))) + (raw_text) @pug) + (#match? @_lang "pug") +) + (comment) @comment |
