redhat-developer / vscode-yaml

YAML support for VS Code with built-in kubernetes syntax support
MIT License
648 stars 219 forks source link

Recommend installing the Kubernetes extension if helm chart is detected #464

Open fbricon opened 3 years ago

fbricon commented 3 years ago

Is your enhancement related to a problem? Please describe.

Some users expect vscode-yaml to support Helm charts, which is actually supported by vscode-kubernetes-tools. See

Describe the solution you would like

Detect the Helm chart syntaxt in a Yaml document. If vscode-kubernetes-tools is not already installed, the display a message recommending to install it.

ssbarnea commented 3 years ago

That is an interesting subject. I am not sure what is the recommendation mechanism on this as my impression was the vscode itself does recommend other extensions based on what they declare as supporting.

I am inside the same board as creator of vscode-ansible extension which extends vscode-yaml. Obviously I would not mind prompting user to install it when specific files are found inside the repository.

At this moment I am not aware of a programatic way an extension could conditionally recommend other extensions. The only option I seen is to configure recommended extensions at workspace level, meaning that each repository owner is expected to populate them in order to work.

I am curious if someone finds something else that can be used.

fbricon commented 3 years ago

vscode-java recommends the installation of the dependency analytics extension, when opening a pom.xml: https://github.com/redhat-developer/vscode-java/commit/bdacd431c8c7a97d014891a1dfa279c715715473

ssbarnea commented 3 years ago

Super, now we have the code that we can reuse there in a bit more generic form as we will need a list of patterns. For Ansible code, a safe list of patterns would be:

# Recommend zbr.vscode-ansible extension
**/{collections,requirements,molecule,galaxy}.yml
**/{.ansible-lint,.yamllint}
**/playbooks/*.{yml,yaml}
**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}
**/meta/main.{yaml,yml}

The list above is a subset of https://github.com/ansible-community/ansible-lint/blob/master/src/ansiblelint/config.py#L14 but it likely covers >99% of the files.

jkryanchou commented 3 years ago

Same issues. Is there any solution we could find it out?