Skip to content

Commit

Permalink
Add pod highlighting (helix-editor#7907)
Browse files Browse the repository at this point in the history
  • Loading branch information
doy authored and mtoohey31 committed Jun 2, 2024
1 parent dde12fc commit 8c217fe
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 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 @@ -114,6 +114,7 @@
| perl || | | `perlnavigator` |
| php |||| `intelephense` |
| po ||| | |
| pod || | | |
| ponylang |||| |
| prisma || | | `prisma-language-server` |
| prolog | | | | `swipl` |
Expand Down
11 changes: 11 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,17 @@ indent = { tab-width = 2, unit = " " }
name = "perl"
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" }

[[language]]
name = "pod"
scope = "source.pod"
injection-regex = "pod"
roots = []
file-types = ["pod"]

[[grammar]]
name = "pod"
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-pod", rev = "d466b84009a63986834498073ec05d58d727d55f" }

[[language]]
name = "racket"
scope = "source.racket"
Expand Down
2 changes: 0 additions & 2 deletions runtime/queries/perl/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
(eof_marker) @keyword.directive
(data_section) @comment

(pod) @comment.block.documentation

(number) @constant.numeric
(version) @constant

Expand Down
2 changes: 2 additions & 0 deletions runtime/queries/perl/injections.scm
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
((comment) @injection.content
(#set! injection.language "comment"))
((pod) @injection.content
(#set! injection.language "pod"))
61 changes: 61 additions & 0 deletions runtime/queries/pod/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[(pod_directive)
(head_directive)
(over_directive)
(item_directive)
(back_directive)
(encoding_directive)
(cut_directive)] @tag

(head_paragraph
(head_directive) @directive
(#eq? @directive "=head1")
(content) @markup.heading.1)
(head_paragraph
(head_directive) @directive
(#eq? @directive "=head2")
(content) @markup.heading.2)
(head_paragraph
(head_directive) @directive
(#eq? @directive "=head3")
(content) @markup.heading.3)
(head_paragraph
(head_directive) @directive
(#eq? @directive "=head4")
(content) @markup.heading.4)
(head_paragraph
(head_directive) @directive
(#eq? @directive "=head5")
(content) @markup.heading.5)
(head_paragraph
(head_directive) @directive
(#eq? @directive "=head6")
(content) @markup.heading.6)

(over_paragraph (content) @constant.numeric.integer)
(item_paragraph (content) @markup.list)
(encoding_paragraph (content) @string)

(verbatim_paragraph (content) @markup.raw)

(interior_sequence) @tag

(interior_sequence
(sequence_letter) @letter
(#eq? @letter "B")
(content) @markup.bold)
(interior_sequence
(sequence_letter) @letter
(#eq? @letter "C")
(content) @markup.raw)
(interior_sequence
(sequence_letter) @letter
(#eq? @letter "F")
(content) @markup.italic)
(interior_sequence
(sequence_letter) @letter
(#eq? @letter "I")
(content) @markup.italic)
(interior_sequence
(sequence_letter) @letter
(#eq? @letter "L")
(content) @markup.link.url)

0 comments on commit 8c217fe

Please sign in to comment.