Skip to content

Commit c5e7f6a

Browse files
authored
fix(pack): Add support for additional Ansible directory structures in ansible's path_regex, and correct docs (#1280)
fix(pack): Add support for additional well-known Ansible directories
1 parent e643030 commit c5e7f6a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lua/astrocommunity/pack/ansible/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
This plugin pack does the following:
44

5+
- Adds a set of local functions to help with Ansible's filetype detection
56
- Adds `yaml` Treesitter parsers
6-
- Adds `ansiblels` language server
7+
- Adds `ansible-lint` and `ansible-language-server` via `mason-tool-installer.nvim`, if enabled
8+
- Sets up `mason-lspconfig.nvim` to use `ansiblels` if enabled
79
- Adds the following `null-ls` sources:
810
- [ansible-lint](https://github.com/ansible/ansible-lint)
9-
- Adds [ansible-vim](https://github.com/pearofducks/ansible-vim) for language specific tools
11+
- Adds the following `nvim-lint` sources:
12+
- [ansible-lint](https://github.com/ansible/ansible-lint)
13+
- Adds [pearofducks/ansible-vim](https://github.com/pearofducks/ansible-vim), and sets it up to be loaded for `yaml.ansible` file types
14+
- Configures [stevearc/conform.nvim](https://github.com/stevearc/conform.nvim) to use `prettierd` and `prettier` for `yaml.ansible` file types

lua/astrocommunity/pack/ansible/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ local function yaml_ft(path, bufnr)
44
if type(content) == "table" then content = table.concat(content, "\n") end
55

66
-- check if file is in roles, tasks, or handlers folder
7-
local path_regex = vim.regex "(tasks\\|roles\\|handlers)/"
7+
local path_regex = vim.regex "(ansible\\|group_vars\\|handlers\\|host_vars\\|playbooks\\|roles\\|\\vars\\|tasks)/"
88
if path_regex and path_regex:match_str(path) then return "yaml.ansible" end
9+
910
-- check for known ansible playbook text and if found, return yaml.ansible
1011
local regex = vim.regex "hosts:\\|tasks:"
1112
if regex and regex:match_str(content) then return "yaml.ansible" end

0 commit comments

Comments
 (0)