diff options
| author | ObserverOfTime <chronobserver@disroot.org> | 2022-10-21 19:48:15 +0300 |
|---|---|---|
| committer | Christian Clason <christian.clason@uni-due.de> | 2022-11-20 12:24:55 +0100 |
| commit | 126a271363ff5307c943e89ff27d0a13e0260f8d (patch) | |
| tree | f1479d9b7008c7ff528459d6df8767cc5e92a5fe | |
| parent | Add Spelling to hcl comments (diff) | |
| download | nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.tar nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.tar.gz nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.tar.bz2 nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.tar.lz nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.tar.xz nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.tar.zst nvim-treesitter-126a271363ff5307c943e89ff27d0a13e0260f8d.zip | |
feat: add mermaid
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/mermaid/highlights.scm | 177 |
4 files changed, 189 insertions, 0 deletions
@@ -249,6 +249,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [markdown](https://github.com/MDeiml/tree-sitter-markdown) (experimental, maintained by @MDeiml) - [x] [markdown_inline](https://github.com/MDeiml/tree-sitter-markdown) (experimental, maintained by @MDeiml) - [x] [menhir](https://github.com/Kerl13/tree-sitter-menhir) (maintained by @Kerl13) +- [ ] [mermaid](https://github.com/monaqa/tree-sitter-mermaid) (experimental) - [x] [meson](https://github.com/Decodetalkers/tree-sitter-meson) (maintained by @Decodetalkers) - [ ] [nickel](https://github.com/nickel-lang/tree-sitter-nickel) - [x] [ninja](https://github.com/alemuller/tree-sitter-ninja) (maintained by @alemuller) diff --git a/lockfile.json b/lockfile.json index 117750ec4..3b13d6063 100644 --- a/lockfile.json +++ b/lockfile.json @@ -230,6 +230,9 @@ "menhir": { "revision": "db7953acb0d5551f207373c81fa07a57d7b085cb" }, + "mermaid": { + "revision": "d787c66276e7e95899230539f556e8b83ee16f6d" + }, "meson": { "revision": "153d22588fb5c1eee16a165a084f9ea30f29d941" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 0ba47880e..0c22f27b2 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1314,6 +1314,14 @@ list.jq = { }, } +list.mermaid = { + install_info = { + url = "https://github.com/monaqa/tree-sitter-mermaid", + files = { "src/parser.c" }, + }, + experimental = true, +} + local M = { list = list, filetype_to_parsername = filetype_to_parsername, diff --git a/queries/mermaid/highlights.scm b/queries/mermaid/highlights.scm new file mode 100644 index 000000000..2f3e31b90 --- /dev/null +++ b/queries/mermaid/highlights.scm @@ -0,0 +1,177 @@ +; adapted from https://github.com/monaqa/tree-sitter-mermaid + +[ + "sequenceDiagram" + "classDiagram" + "classDiagram-v2" + "stateDiagram" + "stateDiagram-v2" + "gantt" + "pie" + "flowchart" + "erdiagram" + + "participant" + "as" + "activate" + "deactivate" + "note " + "over" + "link" + "links" + ; "left of" + ; "right of" + "properties" + "details" + "title" + "loop" + "rect" + "opt" + "alt" + "else" + "par" + "and" + "end" + (sequence_stmt_autonumber) + (note_placement_left) + (note_placement_right) + + "class" + + "state " + + "dateformat" + "inclusiveenddates" + "topaxis" + "axisformat" + "includes" + "excludes" + "todaymarker" + "title" + "section" + + "direction" + "subgraph" + + ] @keyword + +(comment) @comment @spell + +[ + ":" + (sequence_signal_plus_sign) + (sequence_signal_minus_sign) + + (class_visibility_public) + (class_visibility_private) + (class_visibility_protected) + (class_visibility_internal) + + (state_division) + ] @punctuation.delimiter + +[ + "(" + ")" + "{" + "}" + ] @punctuation.bracket + +[ + "-->" + (solid_arrow) + (dotted_arrow) + (solid_open_arrow) + (dotted_open_arrow) + (solid_cross) + (dotted_cross) + (solid_point) + (dotted_point) + ] @operator + +[ + (class_reltype_aggregation) + (class_reltype_extension) + (class_reltype_composition) + (class_reltype_dependency) + (class_linetype_solid) + (class_linetype_dotted) + "&" + ] @operator + +(sequence_actor) @field +(class_name) @field + +(state_name) @field + +(gantt_task_text) @field + +[ + (class_annotation_line) + (class_stmt_annotation) + (class_generics) + + (state_annotation_fork) + (state_annotation_join) + (state_annotation_choice) + ] @attribute + +(directive) @include + +(pie_label) @string +(pie_value) @float + +[ +(flowchart_direction_lr) +(flowchart_direction_rl) +(flowchart_direction_tb) +(flowchart_direction_bt) + ] @constant + +(flow_vertex_id) @field + +[ + (flow_link_arrow) + (flow_link_arrow_start) + ] @operator + +(flow_link_arrowtext "|" @punctuation.bracket) + +(flow_vertex_square [ "[" "]" ] @punctuation.bracket ) +(flow_vertex_circle ["((" "))"] @punctuation.bracket ) +(flow_vertex_ellipse ["(-" "-)"] @punctuation.bracket ) +(flow_vertex_stadium ["([" "])"] @punctuation.bracket ) +(flow_vertex_subroutine ["[[" "]]"] @punctuation.bracket ) +(flow_vertex_rect ["[|" "|]"] @punctuation.bracket ) +(flow_vertex_cylinder ["[(" ")]"] @punctuation.bracket ) +(flow_vertex_round ["(" ")"] @punctuation.bracket ) +(flow_vertex_diamond ["{" "}"] @punctuation.bracket ) +(flow_vertex_hexagon ["{{" "}}"] @punctuation.bracket ) +(flow_vertex_odd [">" "]"] @punctuation.bracket ) +(flow_vertex_trapezoid ["[/" "\\]"] @punctuation.bracket ) +(flow_vertex_inv_trapezoid ["[\\" "/]"] @punctuation.bracket ) +(flow_vertex_leanright ["[/" "/]"] @punctuation.bracket ) +(flow_vertex_leanleft ["[\\" "\\]"] @punctuation.bracket ) + +(flow_stmt_subgraph ["[" "]"] @punctuation.bracket ) + +[ + (er_cardinarity_zero_or_one) + (er_cardinarity_zero_or_more) + (er_cardinarity_one_or_more) + (er_cardinarity_only_one) + (er_reltype_non_identifying) + (er_reltype_identifying) + ] @operator + +(er_entity_name) @field + +(er_attribute_type) @type +(er_attribute_name) @field + +[ + (er_attribute_key_type_pk) + (er_attribute_key_type_fk) + ] @type.qualifier + +(er_attribute_comment) @string @spell |
