diff --git a/lua/astrocommunity/pack/ansible/README.md b/lua/astrocommunity/pack/ansible/README.md index 3272a89d9..6c8a3500c 100644 --- a/lua/astrocommunity/pack/ansible/README.md +++ b/lua/astrocommunity/pack/ansible/README.md @@ -2,8 +2,13 @@ This plugin pack does the following: +- Adds a set of local functions to help with Ansible's filetype detection - Adds `yaml` Treesitter parsers -- Adds `ansiblels` language server +- Adds `ansible-lint` and `ansible-language-server` via `mason-tool-installer.nvim`, if enabled +- Sets up `mason-lspconfig.nvim` to use `ansiblels` if enabled - Adds the following `null-ls` sources: - [ansible-lint](https://github.com/ansible/ansible-lint) -- Adds [ansible-vim](https://github.com/pearofducks/ansible-vim) for language specific tools +- Adds the following `nvim-lint` sources: + - [ansible-lint](https://github.com/ansible/ansible-lint) +- Adds [pearofducks/ansible-vim](https://github.com/pearofducks/ansible-vim), and sets it up to be loaded for `yaml.ansible` file types +- Configures [stevearc/conform.nvim](https://github.com/stevearc/conform.nvim) to use `prettierd` and `prettier` for `yaml.ansible` file types diff --git a/lua/astrocommunity/pack/ansible/init.lua b/lua/astrocommunity/pack/ansible/init.lua index dce20964a..5ed6fa394 100644 --- a/lua/astrocommunity/pack/ansible/init.lua +++ b/lua/astrocommunity/pack/ansible/init.lua @@ -4,8 +4,9 @@ local function yaml_ft(path, bufnr) if type(content) == "table" then content = table.concat(content, "\n") end -- check if file is in roles, tasks, or handlers folder - local path_regex = vim.regex "(tasks\\|roles\\|handlers)/" + local path_regex = vim.regex "(ansible\\|group_vars\\|handlers\\|host_vars\\|playbooks\\|roles\\|\\vars\\|tasks)/" if path_regex and path_regex:match_str(path) then return "yaml.ansible" end + -- check for known ansible playbook text and if found, return yaml.ansible local regex = vim.regex "hosts:\\|tasks:" if regex and regex:match_str(content) then return "yaml.ansible" end