-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Puppet Support #6412
base: master
Are you sure you want to change the base?
Puppet Support #6412
Conversation
(function) @function | ||
(variable) @variable | ||
[ | ||
(identifier) | ||
] @identifier | ||
|
||
[ | ||
"class" | ||
"define" | ||
"plan" | ||
"node" | ||
"type" | ||
] @keyword | ||
|
||
[ | ||
"contain" | ||
"include" | ||
"inherits" | ||
"require" | ||
] @include | ||
|
||
[ | ||
"case" | ||
"else" | ||
"elsif" | ||
"if" | ||
"unless" | ||
] @conditional | ||
|
||
(string) @string | ||
(regex) @regex | ||
(integer) @number | ||
(float) @float | ||
(regex) @string.regex | ||
(comment) @comment | ||
[(true) (false)] @boolean | ||
|
||
(unprotected_string) @text | ||
|
||
[ | ||
(chaining_arrow) | ||
(operator) | ||
] @operator | ||
|
||
|
||
(interpolation | ||
"${" @punctuation.special | ||
"}" @punctuation.special) @none | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scope = "source.puppet" | ||
injection-regex = "puppet" | ||
file-types = ["puppet"] | ||
roots = [] | ||
indent = { tab_width = 2, unit = " " } | ||
comment-token = "#" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file-types = ["pp"]
indent = { tab-width = 2, unit = " " }
there has tip: https://github.com/neovim-puppet/tree-sitter-puppet/tree/main/test/highlight
@jficz The file type here will conflict with pascal, can be overridden by custom languages.toml reconfiguration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually argue that it is Pascal (or, specifically, FreePascal's need to be different) which is in conflict with Puppet here. Historically and practically, .pas
is the recognized Pascal extension. .pp
is just a vendor-specific variant which doesn't really have a rational reason to exist in the first place and therefore it should be the other way around, that is. .pp
for (Free)Pascal files should be overridden by custom language.toml if needed.
Some high-profile Pascal IDEs and variants don't even recognize .pp
as Pascal files as far as I know while for Puppet, .pp
is universally recognized.
I sort out the hightlights, check https://github.com/neovim-puppet/tree-sitter-puppet/tree/main/test/corpus, there are still some highlights that need to be implemented. hightlights.scm (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 Append [
(function_declaration)
(resource_declaration)
(resource_defaults)
(if)
]@indent
[
"case"
"}"
]@outdent |
It would be great to see some Puppet |
so I tried this config using a custom patch against helix release 23.03 which contains the changes to looks like the puppet grammar doesn't build, there is no |
never mind, Need to tune the theme because I don't like the color scheme but the highlighter seems to work. There are a few small issues though:
looks like that it is the dash ( |
Fixes #6073
@jficz will you please test this?