carvel-dev / vscode-ytt

Visual Studio Code extension for working with ytt yaml files
Apache License 2.0
17 stars 0 forks source link

doesn't work with kubernetes extension installed #1

Closed aaronshurley closed 4 years ago

aaronshurley commented 4 years ago

It was reported that the ytt extension does not work with the kubernetes extension already installed, which installed the yaml extension (https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml).

We should try to make these work together, if possible.

drnic commented 4 years ago

For anyone else looking to get ytt extension working: I needed to uninstall the YAML plugin above.

But to uninstall YAML I had to uninstall Kubernetes extension. To uninstall Kubernetes extension I had to uninstall Helm extension.

ig0rsky commented 4 years ago

Simple fix for this problem is to create a new language identifier for .ytt files instead of using the YAML identifier. YAML identifier in VS Code is already overloaded, with everyone coming up with their extension for Kubernetes and Helm :D

Edit: Just found out about this: https://github.com/k14s/ytt/blob/develop/pkg/files/file.go#L15 But we can do this:

diff --git a/package.json b/package.json
index 22d2be2..483e62e 100644
--- a/package.json
+++ b/package.json
@@ -18,9 +18,14 @@
         "Programming Languages"
     ],
     "contributes": {
+        "languages": [{
+            "id": "ytt",
+            "extensions": [ ".yaml", ".yml" ],
+            "aliases": [ "YTT" ]
+        }],
         "grammars": [
             {
-                "language": "yaml",
+                "language": "ytt",
                 "scopeName": "source.yaml.ytt",
                 "path": "./syntaxes/ytt.tmLanguage.json"
             }
ig0rsky commented 4 years ago

@cppforlife What do you think about this solution?

ewrenn8 commented 4 years ago

Thanks for the suggestion @ig0rsky! This change (4d3be9b) was included in our latest release, 0.0.3, which has been published to the marketplace. Users will still need to explicitly select the ytt language from the language selector if they have other YAML extensions installed, but otherwise it should work.