Skip to content

Instantly share code, notes, and snippets.

@jficz
Created May 25, 2023 14:18
Show Gist options
  • Save jficz/c6a7666b73883636e6441e8cf918f755 to your computer and use it in GitHub Desktop.
Save jficz/c6a7666b73883636e6441e8cf918f755 to your computer and use it in GitHub Desktop.
diff --git a/languages.toml b/languages.toml
index a8fdc4a8..7fed07ef 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1941,7 +1941,7 @@ source = { git = "https://github.com/greym0uth/tree-sitter-esdl", rev = "b840c8a
name = "pascal"
scope = "source.pascal"
injection-regex = "pascal"
-file-types = ["pas", "pp", "inc", "lpr", "lfm"]
+file-types = ["pas", "inc", "lpr", "lfm"]
roots = []
comment-token = "//"
indent = { tab-width = 2, unit = " " }
@@ -2421,3 +2421,16 @@ language-server = { command = "nimlangserver" }
[[grammar]]
name = "nim"
source = { git = "https://github.com/aMOPel/tree-sitter-nim", rev = "240239b232550e431d67de250d1b5856209e7f06" }
+
+[[language]]
+name = "puppet"
+scope = "source.puppet"
+injection-regex = "puppet"
+file-types = ["puppet", "pp"]
+roots = []
+indent = { tab-width = 2, unit = " " }
+comment-token = "#"
+
+[[grammar]]
+name = "puppet"
+source = { git = "https://github.com/neovim-puppet/tree-sitter-puppet", rev = "bdedf4d5b13b4020745a678364e2f441cd3abf2a" }
diff --git a/runtime/queries/puppet/highlights.scm b/runtime/queries/puppet/highlights.scm
new file mode 100644
index 00000000..d5a9074b
--- /dev/null
+++ b/runtime/queries/puppet/highlights.scm
@@ -0,0 +1,89 @@
+(function) @function
+(function_declaration
+ (identifier) @function)
+(parameter
+ (variable) @variable.parameter)
+(resource_title) @label
+(resource_declaration (identifier) @type.constructor)
+(resource_call (identifier) @type.constructor )
+(include (identifier) @type.constructor )
+(require (identifier) @type.constructor )
+(contain (identifier) @type.constructor )
+(resource_defaults (resource_type) @type.constructor)
+(argument_list (argument (argument_name) @variable.other.member))
+
+; reference ---
+; (reference (identifier))
+; (reference_identifier)
+
+
+(variable) @variable
+[
+ (identifier)
+] @identifier
+
+[
+ "function"
+] @keyword.function
+
+[
+ "class"
+ "define"
+ "plan"
+ "node"
+ "type"
+] @keyword.storage.type
+
+[
+ "contain"
+ "include"
+ "inherits"
+ "require"
+] @keyword.control.import
+
+[
+ "case"
+ "else"
+ "elsif"
+ "if"
+ "unless"
+] @keyword.control.conditional
+
+(heredoc) @string
+(string) @string
+(regex) @string.regexp
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
+(comment) @comment
+[(true) (false)] @constant.boolean
+
+(unprotected_string) @text
+
+[
+ (chaining_arrow)
+ (operator)
+] @operator
+
+
+(interpolation
+ "${" @punctuation.special
+ "}" @punctuation.special) @none
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ ]@punctuation.bracket
+
+[
+ ","
+ ":"
+ "::"
+] @punctuation.delimiter
+
+[(type) (type_identifier)] @type
+
+(escape_sequence) @constant.character.escape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment