Separate ansible language #11818
-
In my [[language]]
name = "ansible"
comment-token = "#"
file-types = [
{ glob = "playbooks/*.yaml" },
{ glob = "playbooks/*.yml" },
{ glob = "group_vars/*.yaml" },
{ glob = "group_vars/*.yml" },
{ glob = "host_vars/*.yaml" },
{ glob = "host_vars/*.yml" },
{ glob = "vars/*.yaml" },
{ glob = "vars/*.yml" },
{ glob = "defaults/*.yaml" },
{ glob = "defaults/*.yml" },
{ glob = "tasks/*.yaml" },
{ glob = "tasks/*.yml" },
{ glob = "handlers/*.yaml" },
{ glob = "handlers/*.yml" },
{ glob = "meta/*.yaml" },
{ glob = "meta/*.yml" },
]
formatter = { command = "yamlfmt", args = ["-"] }
grammar = "yaml"
indent = { tab-width = 2, unit = " " }
injection-regex = "ansible"
language-servers = ["ansible-language-server"]
scope = "source.yaml"
shebangs = ["ansible-playbook"]
[[language]]
name = "yaml"
formatter = { command = "yamlfmt", args = ["-"] }
language-servers = ["yaml-language-server"] The ansible's LSP is working fine, but my "ansible files" syntax is not highlighted anymore. Any idea why? Thanks 🙏
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You'll need to set up highlight queries for the new ansible language. In your runtime directory ( |
Beta Was this translation helpful? Give feedback.
You'll need to set up highlight queries for the new ansible language. In your runtime directory (
HELIX_RUNTIME
if set,~/.config/helix/runtime
otherwise) you'll need to createqueries/ansible/highlights.scm
queries/ansible/injections.scm
files with the contents; inherits: yaml
.grammar = "yaml"
in language configuration re-uses the tree-sitter parser and then you need to set up queries.starlark
is a good example of a language reusing another language's parser and queries (python).