esphome / esphome-vscode

ESPHome VSCode plugin
Other
75 stars 14 forks source link

hidden files arent picked up #84

Closed kinghat closed 7 months ago

kinghat commented 1 year ago

when hiding files from the dashboard that are used for yaml insertion via prepending a dot to the file name: https://esphome.io/guides/configuration-types.html#yaml-insertion-operator, the extension no longer picks up the file as its own: even if "esphome" is also in the file name.

image

glmnet commented 1 year ago

you mean, it does not auto selects ESPHome at bottom right?

kinghat commented 1 year ago

you mean, it does not auto selects ESPHome at bottom right?

hey @glmnet! yep thats correct.

glmnet commented 1 year ago

is this the ESPHome inside the HA's Studio Code Server? In that case this might be relevant: https://github.com/hassio-addons/addon-vscode/blob/main/vscode/rootfs/root/.code-server/settings.json

May be the pattern in lines 4 and 5 aren't matching your setup. You can try fiddling with that, see this for more information https://stackoverflow.com/questions/29973619/how-to-associate-a-file-extension-with-a-certain-language-in-vs-code

If you find a setting working better for you, you might want to create an issue on that repo

I could not reproduce here though...

image

kinghat commented 1 year ago

is this the ESPHome inside the HA's Studio Code Server? In that case this might be relevant: https://github.com/hassio-addons/addon-vscode/blob/main/vscode/rootfs/root/.code-server/settings.json

this is through the vscode remote ssh extension.

image

image

only have the ha and esphome extensions installed on the remote:

image

could my vscode settings.json file.associations key be conflicting? what does yours look like?:

  "files.associations": {
    "esphome*.yaml": "esphome",
    "**/home-assistant/**": "home-assistant",
    "*.yaml": "yaml"
  },

are any of these file associations needed? i installed the flatpak'd version of vscode to get a fresh install and added, esphome, home assistant and the yaml extensions and none of these associations were added to its settings.json file :thinking:

if i comment out the files.associations block, while still only having the esphome and home assistant extensions installed on the remote, it now picks up the esphome and .esphome files as home assistant files :man_shrugging:

more testing, if i remove both extensions and delete any .vscode/settings.json files, reload vscode, install only esphome extension, i get the correct esphome formatter for .esphome and esphome files. if i then add the home assistant extension, those files are not recognized as a home assistant formatter and the .vscode/settings.json file is added back with these contents:

{
  "files.associations": {
    "*.yaml": "home-assistant"
  }
}
kinghat commented 1 year ago

do you know why the home assistant extension is trying to handle esphome extension contexts and not esphome extension handling its own files? https://github.com/hassio-addons/addon-vscode/blob/8149899349d5d5f0f9095b4fb47950d5ad58541e/vscode/rootfs/root/.code-server/settings.json#L4 https://github.com/hassio-addons/addon-vscode/pull/211

for me i dont even see the home assistant file associations work for esphome files.