@yaegassy/coc-ansible
yaegassyansible-language-server extension for coc.nvim
Published Package Summary
coc-ansible
ansible-language-server extension for coc.nvim
Install
CocInstall:
:CocInstall @yaegassy/coc-ansible
scoped packages
vim-plug:
Plug 'yaegassy/coc-ansible', {'do': 'yarn install --frozen-lockfile'}
Note
[!! Very important !!] Filetype related
-
The "filetype" must be
yaml.ansiblefor this extension to work.If you install ansible's vim plugin,
yaml.ansiblefiletype will be added automatically, which is very useful (e.g. pearofducks/ansible-vim or sheerun/vim-polyglot). -
You also need to set
g:coc_filetype_mapin.vimrc/init.vim.let g:coc_filetype_map = { \ 'yaml.ansible': 'ansible', \ }
Requirements (Tools)
- Ansible 2.9+
- Ansible Lint (required, unless you disable linter support)
- [TIPS]
coc-ansiblewill automatically disable the feature ifansible-lintis not found
- [TIPS]
- yamllint (optional)
If you also install
yamllint,ansible-lintwill detect it and incorporate into the linting process. Any findings reported byyamllintwill be exposed in coc.nvim as errors/warnings.
Bult-in install
coc-ansible allows you to create an extension-only "venv" and install ansible, ansible-lint and yamllint.
yamllint will be installed by setting ansible.builtin.isWithYamllint to true (default: false).
You can also specify the version of each tool. (setting: ansible.bultin.ansibleVersion, ansible.bultin.ansibleLintVersion, ansible.bultin.yamllintVersion)
The first time you use coc-ansible, if ansible, ansible-lint is not detected, you will be prompted to do a built-in installation.
You can also run the installation command manually.
:CocCommand ansible.builtin.installRequirementsTools
Code Actions
Example key mapping (Code Action related):
nmap <silent> ga <Plug>(coc-codeaction-line)
Usage:
In the line with diagnostic message, enter the mapped key (e.g. ga) and you will see a list of code actions that can be performed.
Actions:
Ignoring rules for current line (# noqa [ruleId])| DEMO- Requires
ansible-lint"v6.8.1" or later.
- Requires
Show web documentation for [ruleId]| DEMO- Requires
ansible-lint"v6.8.1" or later.
- Requires
Thanks
License
MIT
This extension is built with create-coc-extension
- ansible-language-server extension for coc.nvim
- onLanguage:ansible
- onLanguage:yaml.ansible
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for @yaegassy/coc-ansible@0.15.2.
| Command (:CocCommand) | Description |
|---|---|
| ansible.builtin.installRequirementsTools | Install ansible, ansible-lint and yamllint(optional) with extension's venv |
| ansible.server.restart | Restart ansible language server |
| ansible.server.showMetaData | Show ansible-metadata for ansible language server |
| ansible.server.resyncAnsibleInventory | Resync Ansible Inventory |
| ansible.ansbileDoc.showInfo | Run the `ansible-doc` command in a terminal window with various options to display information about the plugins |
| ansible.ansbileDoc.showSnippets | Run the `ansible-doc` command in a terminal window with various options to display a snippets of the plugins. |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable coc-ansible extension."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "ansible",
"description": "Path to the ansible executable. All subcommands are expected to have adjacent locations."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Whether to force builtin tools instead those in the PATH"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Absolute path to ansible language server module. If it is not set, use the extention's server module. (For develop and check)"
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "ansible-doc",
"description": "Path to the ansible-doc executable."
}Raw JSON Schema
{
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Toggle validation provider. If enabled and ansible-lint is disabled, validation falls back to ansible-playbook --syntax-check."
}Raw JSON Schema
{
"enum": [
"off",
"messages",
"verbose"
],
"type": "string",
"default": "off",
"description": "Traces the communication between coc.nvim and the ansible language server."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "ansible-lint",
"description": "Path to the ansible-lint executable."
}Raw JSON Schema
{
"type": "string",
"scope": "machine-overridable",
"default": "ansible-navigator",
"description": "Points to the ansible-navigator executable."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Version of ansible for built-in install."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Whether to install yamllint the built-in installer."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "",
"description": "Path to the python/python3 executable. This settings may be used to make the extension work with ansible and ansible-lint installations in a python virtual environment"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Version of yamllint for built-in install."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "",
"description": "Path to the virtual environment activation script. Use only if you have a custom activation script. It will be sourced using bash before executing Ansible commands. When set, the Interpreter Path setting is ignored."
}Raw JSON Schema
{
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Toggle usage of ansible-lint."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "",
"description": "Optional command line arguments to be appended to ansible-lint invocation."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Version of ansible-lint for built-in install."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "quay.io/ansible/creator-ee:latest",
"description": "Specify the name of the execution environment image."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Use vertical belowright for ansible-doc terminal window."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Disable progress notifications from ansible-language-server"
}Raw JSON Schema
{
"type": "boolean",
"scope": "resource",
"default": false,
"description": "Enable or disable the use of an execution environment."
}Raw JSON Schema
{
"enum": [
"always",
"missing",
"never",
"tag"
],
"type": "string",
"scope": "resource",
"default": "missing",
"description": "Specify the image pull policy.\nalways: Always pull the image when extension is activated or reloaded\nmissing: Pull if not locally available\nnever: Never pull the image\ntag: If the image tag is 'latest', always pull the image, otherwise pull if not locally available"
}Raw JSON Schema
{
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Toggle redirected module provider when completing modules."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "object",
"properties": {
"src": {
"type": "string",
"description": "The name of the local volume or path to be mounted within execution environment."
},
"dest": {
"type": "string",
"description": "The path where the file or directory are mounted in the container."
},
"options": {
"type": "string",
"description": "The field is optional, and is a comma-separated list of options, such as ro,Z"
}
}
},
"scope": "resource"
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "",
"description": "Specify any additional parameters that should be added to the pull command when pulling an execution environment from a container registry. e.g. '--tls-verify=false'"
}Raw JSON Schema
{
"enum": [
"auto",
"podman",
"docker"
],
"type": "string",
"scope": "resource",
"default": "auto",
"description": "Specify the container engine (auto=podman then docker)."
}Raw JSON Schema
{
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Toggle alias provider when completing module options."
}Raw JSON Schema
{
"type": "string",
"scope": "resource",
"default": "",
"description": "Extra parameters passed to the container engine command example: '--net=host'"
}Raw JSON Schema
{
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Always use fully qualified collection names (FQCN) when inserting a module name. Disabling it will only use FQCNs when necessary."
}