Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible #151

Open
1 task done
walterrowe opened this issue Dec 16, 2022 · 4 comments
Open
1 task done

Ansible #151

walterrowe opened this issue Dec 16, 2022 · 4 comments
Labels
language A request to add a language extension

Comments

@walterrowe
Copy link

Check for existing issues

  • Completed

Language

ansible / YAML

Tree Sitter parser link

https://github.com/ikatyang/tree-sitter-yaml

Language server link

https://github.com/redhat-developer/yaml-language-server

Misc notes

Would like to see ansible / YAML supported.

@walterrowe walterrowe added the language A request to add a language extension label Dec 16, 2022
@JosephTLyons JosephTLyons changed the title ansible support Ansible support Dec 18, 2022
@AravindhStanley
Copy link

AravindhStanley commented Oct 8, 2023

Lack of ansible support is the only reason that is holding me back from using Zedd as my full time code editor

@rosingrind
Copy link

Ansible is usually done with Jinja templates, so this probably belongs here:

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@antoinetielbeke
Copy link

+1. We do not use Ansible but mostly YAML + Jinja and Zed is a little unusable for that right now.

@iafelix
Copy link

iafelix commented Feb 21, 2024

+1

Would be nice to be capable of to provide which LSP must be used.
Taking just a few examples from https://www.schemastore.org/api/json/catalog.json, for instance YAML files.

There are many ways that we should be capable of to do so:

  • By providing the magic comment yaml-language-server an entire set of options could be used.
# yaml-language-server: $schema=https://json.schemastore.org/yamllint.json
---
extends: default
yaml-files: ["*.yaml", "*.yml", ".yamllint"]
ignore: |
  .build/
  .github/
  vendor/

It would be great if there were a setting, such as the fileMatch option, that could automatically configure the url for the LSP. This feature is currently missing in a few examples below.

  • For Docker Compose:
     {
      "name": "docker-compose.yml",
      "description": "The Compose specification establishes a standard for the definition of multi-container platform-agnostic applications",
      "fileMatch": [
        "**/docker-compose.yml",
        "**/docker-compose.yaml",
        "**/docker-compose.*.yml",
        "**/docker-compose.*.yaml",
        "**/compose.yml",
        "**/compose.yaml",
        "**/compose.*.yml",
        "**/compose.*.yaml"
      ],
      "url": "https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"
    }
  • This applies to language subsets as well, such as Ansible, which is the subject of this issue.
[
{
      "name": "Ansible Execution Environment",
      "description": "Ansible execution-environment.yml file",
      "fileMatch": ["**/execution-environment.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/execution-environment.json"
    },
    {
      "name": "Ansible Meta",
      "description": "Ansible meta/main.yml file",
      "fileMatch": ["**/meta/main.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta.json"
    },
    {
      "name": "Ansible Meta Runtime",
      "description": "Ansible meta/runtime.yml file",
      "fileMatch": ["**/meta/runtime.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta-runtime.json"
    },
    {
      "name": "Ansible Argument Specs",
      "description": "Ansible meta/argument_specs.yml file",
      "fileMatch": ["**/meta/argument_specs.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/role-arg-spec.json"
    },
    {
      "name": "Ansible Requirements",
      "description": "Ansible requirements file",
      "fileMatch": ["requirements.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/requirements.json"
    },
    {
      "name": "Ansible Vars File",
      "description": "Ansible variables File",
      "fileMatch": [
        "**/vars/*.yml",
        "**/vars/*.yaml",
        "**/defaults/*.yml",
        "**/defaults/*.yaml",
        "**/host_vars/*.yml",
        "**/host_vars/*.yaml",
        "**/group_vars/*.yml",
        "**/group_vars/*.yaml"
      ],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/vars.json"
    },
    {
      "name": "Ansible Tasks File",
      "description": "Ansible tasks file",
      "fileMatch": [
        "**/tasks/*.yml",
        "**/tasks/*.yaml",
        "**/handlers/*.yml",
        "**/handlers/*.yaml"
      ],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/tasks"
    },
    {
      "name": "Ansible Playbook",
      "description": "Ansible playbook files",
      "fileMatch": [
        "playbook.yml",
        "playbook.yaml",
        "site.yml",
        "site.yaml",
        "**/playbooks/*.yml",
        "**/playbooks/*.yaml"
      ],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/playbook"
    },
    {
      "name": "Ansible Rulebook",
      "description": "Ansible rulebook files",
      "fileMatch": ["**/rulebooks/*.yml", "**/rulebooks/*.yaml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-rulebook/main/ansible_rulebook/schema/ruleset_schema.json"
    },
    {
      "name": "Ansible Inventory",
      "description": "Ansible inventory files",
      "fileMatch": ["inventory.yml", "inventory.yaml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json"
    },
    {
      "name": "Ansible Collection Galaxy",
      "description": "Ansible Collection Galaxy metadata",
      "fileMatch": ["galaxy.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/galaxy.json"
    },
    {
      "name": "Ansible-lint Configuration",
      "description": "Ansible-lint Configuration",
      "fileMatch": [".ansible-lint", "**/.config/ansible-lint.yml"],
      "url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json"
    },
    {
      "name": "Ansible Navigator Configuration",
      "description": "Ansible Navigator Configuration",
      "fileMatch": [
        ".ansible-navigator.json",
        ".ansible-navigator.yaml",
        ".ansible-navigator.yml",
        "ansible-navigator.json",
        "ansible-navigator.yaml",
        "ansible-navigator.yml"
      ],
      "url": "https://raw.githubusercontent.com/ansible/ansible-navigator/main/src/ansible_navigator/data/ansible-navigator.json"
    }
]

Finally, you can change the language manually through the user interface by selecting the language from the bottom bar or accessing the command palette and toggling the language from there.

VSCode does all that, please double check modelines and file association with ansible-language-server for the Ansible LSP docs

@JosephTLyons JosephTLyons transferred this issue from zed-industries/zed Feb 26, 2024
@JosephTLyons JosephTLyons changed the title Ansible support Ansible Feb 26, 2024
@Moshyfawn Moshyfawn mentioned this issue Mar 6, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language A request to add a language extension
Projects
None yet
Development

No branches or pull requests

5 participants