Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lua/astrocommunity/pack/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion lua/astrocommunity/pack/ansible/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading