Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Cargo.toml

This file was deleted.

2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ repository = "https://github.com/nusnewob/caddyfile-zed"

[grammars.caddyfile]
repository = "https://github.com/caddyserver/tree-sitter-caddyfile.git"
commit = "a599a9ca6729d4a115f59a7f12247e86e9a78008"
commit = "8951716aa2855e02dada302c540a90f277546095"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on my testing, new commits after this breaks syntax highlighting.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I've rolled back to caddyserver/tree-sitter-caddyfile@462aa78

which works for me, but still breaks if snippets and sites are intermingled as I described here caddyserver/tree-sitter-caddyfile#52 but an improvement over the current state.

64 changes: 37 additions & 27 deletions languages/caddyfile/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
(comment) @comment
[
(environment_variable)
(placeholder)
] @constant

[
(url)
(unix_socket)
(network_address)
(ip_address_or_cidr)
(path)
] @type
(placeholder) @constant

(site_address) @keyword
[
(directive_name)
(snippet_name)
] @property
(snippet_name)
(named_route_identifier)
(site_address)
] @keyword

(directive (directive_name) @property)

; declaration of a named matcher
(named_matcher (matcher_identifier (matcher_name)) @function.macro)

; reference to a named matcher
(matcher (matcher_identifier (matcher_name)) @function.macro)

(named_matcher (matcher_name) @function.method)
; directive within a named matcher declaration
(matcher_directive (matcher_directive_name) @function.method)

(matcher) @function.call
; any other matcher (wildcard and path)
(matcher) @function.macro

[
(interpreted_string_literal)
(raw_string_literal)
(interpreted_string_literal)
(raw_string_literal)
(heredoc)
(cel_expression)
] @string

(escape_sequence) @escape

(int_literal) @number

(comment) @comment
[
(duration_literal)
(int_literal)
] @number

;[
; "on"
; "off"
; "first"
; "last"
; "before"
; "after"
; "internal"
; "strip_prefix"
; "strip_suffix"
; "replace"
;] @constant
[
"{"
"}"
] @punctuation.bracket
9 changes: 1 addition & 8 deletions languages/caddyfile/indents.scm
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
[ "{" ] @indent.end

[ "{" "}" ] @indent.branch

[
(ERROR)
(comment)
] @indent.auto
(_ "{" "}" @end) @indent
6 changes: 6 additions & 0 deletions languages/caddyfile/injections.scm
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
(comment) @comment
((cel_expression) @injection.content
(#set! injection.language "cel"))

(heredoc
(heredoc_body) @injection.content
(heredoc_end) @injection.language)
2 changes: 1 addition & 1 deletion languages/caddyfile/locals.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(block) @local.scope

(named_matcher (matcher_name) @local.definition)
(named_matcher (matcher_identifier (matcher_name)) @local.definition)

(matcher) @local.reference
11 changes: 0 additions & 11 deletions src/lib.rs

This file was deleted.