vscode-peacock: Don't create workspace settings.json unless a color is chosen

If Peacock is disabled and I open VSCode, no workspace folder is created:

$ ls -a
./  ../
$ code .
$ ls -a
./  ../

If Peacock is enabled (even with "peacock.surpriseMeOnStartup": false), it creates a workspace folder with default settings:

$ ls -a
./  ../
$ code .
$ ls -a
./  ../  .vscode/
$ bat --style=header .vscode/*
File: .vscode/settings.json
{
    "workbench.colorCustomizations": {
        "editor.selectionBackground": "#888",
        "editor.selectionHighlightBackground": "#555",
        "editor.findMatchHighlightBackground": "#2cdd1c65",
        "editorIndentGuide.activeBackground": "#888",
        "titleBar.activeBackground": "#777777",
        "titleBar.inactiveBackground": "#77777799",
        "titleBar.activeForeground": "#e7e7e7",
        "titleBar.inactiveForeground": "#e7e7e799",
        "tab.activeBorder": "#909090"
    }
}

I have .vscode directories with default settings littered all over because of this. Please only create settings if a color is specifically chosen (or if “surprise me on startup” is set, of course).

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

The accents are a new feature which can be turned on or off in settings (see the readme and changelog). The statusbar is just to show you what your color is. So these don’t affect it.

The memento is just a variable that stores the color you select. Previously Peacock was not storing your color, now it does (in a memento).

I just republished 2.5.2. Can you try with that version and report back?

thanks …

I’m having trouble reproducing this. Can you help clarify … I think you are saying that if you open Peacock in a project that has no peacock colors in the workspace settings (.vscode/settings.json) that Peacock is writing colors to .vscode/settings.json. If so, that is a bug, but I cannot repro this.

Or are you saying you open one project, use Peacock and set to a color (blue), then open another project that uses Peacock and the colors are also set to blue. (color is being copied - which is undesired)

Also - if you open the “output” panel and choose “peacock” there may be some messages there as I log to it. Can you check what is there and share that?

thanks for the feedback

EDIT: Further investigation - I think the Reset Colors is was the fix, not the version change. I’m having to do this per project, where is this hidden setting stored?

2.5.0 introduced a workspace memento (a saved variable for your workspace) that stores the most recently used color for this specific workspace. This was needed due to the remote features introduced. I’m sensing (but cannot confirm) that somehow this memento is being read by peacock and then setting your colors to it. But … that memento is only set when you apply peacock to a specific folder/workspace (and there is one memento per folder/workspace). So this could happen if you set a color (blue), then remove the workspace settings, then reload and blue would be applied again. Why? Because the memento does not get written (cleared) when you manually delete a color (yet another reason i dont like this approach and will move to a setting).

But I am not sure if this explains your scenarios … because this would only happen if in the workspace you had previously set a color (which is what sets the memento) and then removed the colors manually (delete the file, remove the settings). This I can reproduce and is a bug. But it sounded like your scenario was going to a folder where Peacock never existed … and then it appears. That, i cant reproduce.

Please comment on these assertions I made above and let me know if I follow you correctly or not.

sidenote - The memento is likely going away in the next version as I prefer a user settings hidden variables

also, i am reverting 2.5.1 as while I am not sure it caused the problem , I am sure that it would make it more frequently appear. So 2.5.2 is published now (which reverts 2.5.1)