Skip to content

Commit

Permalink
feat: language support for mail files (#12945)
Browse files Browse the repository at this point in the history
  • Loading branch information
ficcdaf authored Feb 26, 2025
1 parent 26cb3c2 commit bb3af14
Show file tree
Hide file tree
Showing 4 changed files with 52 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 @@ -134,6 +134,7 @@
| log || | | |
| lpf || | | |
| lua |||| `lua-language-server` |
| mail ||| | |
| make || || |
| markdoc || | | `markdoc-ls` |
| markdown || | | `marksman`, `markdown-oxide` |
Expand Down
10 changes: 10 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,16 @@ injection-regex = "tablegen"
name = "tablegen"
source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "3e9c4822ab5cdcccf4f8aa9dcd42117f736d51d9" }

[[language]]
name = "mail"
scope = "text.mail"
file-types = ["eml"]
injection-regex = "mail|eml|email"

[[grammar]]
name = "mail"
source = { git = "https://github.com/ficcdaf/tree-sitter-mail", rev = "8e60f38efbae1cc5f22833ae13c5500dd0f3b12f" }

[[language]]
name = "markdown"
scope = "source.md"
Expand Down
28 changes: 28 additions & 0 deletions runtime/queries/mail/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
; header fields
[
(header_field_email)
(header_field_subject)
(header_field)
] @keyword

; delimited punctuation
(header_separator) @punctuation.delimiter
(email_delimiter) @punctuation.delimiter

; email subject contents
(header_subject
(subject) @markup.bold)
; extra metadata headers
(header_other
(header_unstructured) @comment)

; Addressee Name (Firstname, Lastname, etc.)
(atom) @variable

; Email Address
(email) @string

; Quoted Reply
(quote_marker) @punctuation.special
(quote_contents) @markup.quote

13 changes: 13 additions & 0 deletions runtime/queries/mail/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(atom_block
(atom) @entry.inside) @entry.around

(email_address) @entry.around
(header_other
(header_unstructured) @entry.around)

(quoted_block)+ @comment.around

(body_block)+ @function.around

(header_subject
(subject) @function.around)

0 comments on commit bb3af14

Please sign in to comment.