catppuccin / vscode

🦌 Soothing pastel theme for VSCode & Azure Data Studio
https://marketplace.visualstudio.com/items?itemName=Catppuccin.catppuccin-vsc-pack
MIT License
1.44k stars 52 forks source link

Catppuccin extension settings don't respect Profile settings #452

Open abhbh opened 1 week ago

abhbh commented 1 week ago

If Catppuccin options are configured in separate VSCode profiles, the last edited options in any of the settings.json take effect in all VS Code profiles.

Steps to reproduce:

  1. Create 2+ profiles in VS Code
  2. In the default profile, configure accent color to Red and extra borders.
  3. Switch to Profile 2.
  4. Profile 2 also has the accent color Red and border even though the Settings says otherwise.
  5. Change accent color in Profile 2 to Green.
  6. If you switch to Default profile, the color is Green but Settings says Red.
  7. Profile 3 as no configuration done but accent color of the theme is Green (which was set in Profile 2).

Expected Result

  1. Extension should either read configuration per profile's settings.json
  2. Or keep its configuration application-wide which always writes to the default profile i.e. scope set to application (these configurations show up in Settings with Applies to all profiles subtitle irrespective of profile used)
backwardspy commented 1 week ago

thanks for raising this!

i believe this is caused by the same underlying issue as #443; we "compile" the theme to a json file before applying it, and that currently does not take profiles and workspaces into account. i'll close this issue as it should be fixed at the same time as 443.

sgoudham commented 1 week ago

Duplicate of #443

abhbh commented 1 week ago

i'll close this issue as it should be fixed at the same time as 443

👍

backwardspy commented 1 week ago

@sgoudham and i have done some more research into this issue, and for now it looks like there's unfortunately not much we can do to support this. vscode does not have a profiles API so we are unable to get the current profile in a supported way. this means that our customisation system is unable to work per-profile.

the officially supported method for this situation is to ship static themes that cannot be customised. this is not currently an acceptable solution for us - we have far too many customisation options (and people using them) to simply remove them in favour of static theme files.

we will continue to look into this to see if there's some workaround we can provide, but at the moment it unfortunately does not look good.

abhbh commented 1 week ago

The issue is that Catppuccin configuration is currently saved per profile but it doesn't read it when selected profile changes. If the extension's customization system cannot support profiles, the configuration should be saved at application scope. This will at least remove the undefined behavior that the user currently sees.

sgoudham commented 1 week ago

The issue is that Catppuccin configuration is currently saved per profile but it doesn't read it when selected profile changes

I don't believe your statement "Catppuccin configuration is currently saved per profile" is true. We directly write to a themes/ directory on disk with no extra name-spacing for profiles. The theme is regenerated when the settings are updated, hence why the window needs to be reloaded.

I haven't looked into it yet but I don't believe there's an API / event for detecting when the user has switched profiles.

abhbh commented 1 week ago

Catppuccin configuration is currently saved per profile

By this I mean the contributes.configuration object: https://github.com/catppuccin/vscode/blob/bbb0b5a231a082790398613266e56268ae2e4de0/packages/catppuccin-vsc/package.json#L55 is written per profile. Not what the extension writes to disk.

sgoudham commented 1 week ago

Sure. It still remains that we cannot support per profile customisation because the theme is regenerated every time the workspace settings are changed, without any name-spacing for profiles.

There are multiple ways you can try to solve this, if supported by VSCode:

  1. VSCode would need to provide a onDidChangeProfile() event or equivalent when the user switches profile so that we can regenerate the theme. - I couldn't find anything like this while scrolling the API documentation.
  2. VSCode allows extensions to get the name of the current profile so that we can write the theme files to disk namespaced by profile. - Not currently possible as mentioned above.
  3. As @backwardspy mentioned above, you would need to ship static themes so that the theme file on disk is unchanged. (which is what you're supposed to do) - We are not interested in pursing this.
abhbh commented 1 week ago

I hit the same roadblock when searching the Extension API documentation. So I understand your decision.

If supporting profiles is not possible or not in the roadmap, at least the inconsistency between settings.json of different profiles should be fixed by setting scope: application for all the contributed configurations in the manifest. It will sync state of Catppuccin extension configuration in VSCode between all user profiles.

sgoudham commented 1 week ago

I didn't realise that you could enforce that, good to know! Looks like the documentation is inside the contribution points, as you mentioned. Leaving the screenshot below for easy reference:

image