vscode-home-assistant icon indicating copy to clipboard operation
vscode-home-assistant copied to clipboard

The VSCode settings.json file is getting created on non-HA repos

Open pedrolamas opened this issue 4 years ago • 19 comments

When I open some random repositories on VSCode, I can see the .vscode/settings.json getting created, yet those repos have nothing to do with HA configuration!

A good example if the zigbee2mqtt: just clone the repo, open in VS Code (do ensure that this extension is enabled and running first) and observe the file getting created.

Extension runs in:

  • [X] VS Code for Desktop
  • [ ] Hassio Add-on
  • [ ] Visual Studio Online
  • [ ] Other:

I'm running VS Code on:

  • [X] Windows
  • [ ] Mac
  • [ ] Linux

I'm accessing my files:

  • [X] From local disk
  • [X] Via remote SSH
  • [X] Smb
  • [ ] Other:

pedrolamas avatar Feb 02 '21 16:02 pedrolamas

.vscode/settings.json is a vscode settings file and not specific to this extension. The extension doesn't even manage that file? What makes you conclude it comes from this extension?

frenck avatar Feb 02 '21 16:02 frenck

Sorry @frenck, but I believe this block tells me otherwise: https://github.com/keesschollaart81/vscode-home-assistant/blob/438700f8b16585f58154194b0c3a1555fa51a916/src/extension.ts#L336-L338

This is what created the file and the content on it matches what is there!

pedrolamas avatar Feb 02 '21 17:02 pedrolamas

Well spotted! Thanks for providing that insight 👍

frenck avatar Feb 02 '21 17:02 frenck

+1 to this, I have to uninstall/disable the extension as it injects workspace settings in workspaces that have nothing to do with Home Assistant. This feature is nice for new users but is a bit overkill. If someone wants to add the file association manually then it would be great to have as a how-to in the documentation of the extension, but I feel like someone that's familiar enough to get to the point of installing the VSCode extension for Home Assistant intellisense/snippets/etc is going to be aware of fileAssociations in Code

scrthq avatar Feb 22 '21 23:02 scrthq

Several times a week this gets added. Always have to revert (git) the change.

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

Would it be possible to check for known HA files to conclude it's an HA folder, and only then add the file associations?

Look like there is something built-in already https://github.com/keesschollaart81/vscode-home-assistant/blob/438700f8b16585f58154194b0c3a1555fa51a916/package.json#L27-L33 So the extension gets activated incorrectly. Check only for home-assistant_v2.db would be stricter, and I'm guessing you can't have HA without home-assistant_v2.db.

Or maybe have a setting to the extension to disable this?

Somewhat related #137

DavidDeSloovere avatar Feb 25 '21 19:02 DavidDeSloovere

I'd love this to be a configurable setting for the extension, since it does add value for some users, I'm sure. This would also not break the default behavior of the extension but allow for a little more granularity around when that feature is desirable.

Checking out the code and sending a PR if it's manageable

scrthq avatar Feb 25 '21 19:02 scrthq

PR #1026 created to add the setting to disable automatic file association.

scrthq avatar Feb 25 '21 20:02 scrthq

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '21 16:06 stale[bot]

Still an active issue...

pedrolamas avatar Jun 02 '21 22:06 pedrolamas

Yup, I also still see this weekly.

DavidDeSloovere avatar Jun 03 '21 09:06 DavidDeSloovere

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 02 '21 19:08 stale[bot]

Still an active issue...

pedrolamas avatar Aug 02 '21 21:08 pedrolamas

This is getting old quite fast...

Here's another example of a completely unrelated HA repo getting the offending settings.json file created... 😕

image

pedrolamas avatar Aug 12 '21 14:08 pedrolamas

Same here. Keeps happening in a variety of repos I work on that contain .yaml files.

silverl avatar Dec 08 '21 18:12 silverl

The YAML format is used by a LOT of different tools and projects. So in almost every project I have, this extension forcibly inserts its own settings into the project's .vscode/settings.json or .code-workspace file (which are committed to version control) to forcibly associate itself with all YAML files in that project. And if that change is removed, the extension automatically re-adds it.

That's what I would call viral behaviour.

It is not ok to do this. Further, I would expect that such behaviour wouldn't be accepted by the VS Code Marketplace.

Unfocused avatar Mar 26 '22 09:03 Unfocused

Fact is this plugin is exhibiting a dark pattern, no other way to put it.

The fix is trivial and easy for any maintainer - just stopping auto adding the plugin as handler! - but considering the amount of time that has passed since I opened this ticket and nothing actually changed, I don't think any action will be taken to change this.

pedrolamas avatar Mar 28 '22 17:03 pedrolamas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 12 '22 17:06 stale[bot]

Still a valid issue.

pedrolamas avatar Jun 12 '22 22:06 pedrolamas

This is such a pervasive issue that I've sadly had to drop the plugin. 18 months later, I'm assuming it's not getting fixed.

MaxVRAM avatar Oct 31 '22 00:10 MaxVRAM