material-theme / vsc-material-theme

Material Theme, the most epic theme for Visual Studio Code
https://www.material-theme.dev
Other
11.21k stars 789 forks source link

using this extension on a read-only filesystem #1294

Closed Stunkymonkey closed 3 months ago

Stunkymonkey commented 8 months ago

Describe the bug On NixOS the extension is placed on a read-only filesystem. So writing for the user.material-theme.config.json fails.

To Reproduce Steps to reproduce the behavior:

  1. Open VScode
  2. See Error

Expected behavior No error message.

Error message

Material Theme: there was an error while loading the configuration. Please retry or open an issue: Unknown (FileSystemError) (FileSystemError): Error: EROFS: read-only file system, open '/nix/store/z8d0d137i4clca4dk17x7yncnn22wbdi-vscode-extension-Equinusocio-vsc-material-theme-34.3.1/share/vscode/extensions/Equinusocio.vsc-material-theme/user.material-theme.config.json'

What I tried

Is there a good way you can provide a fix? Do you suggest to patch (/remove) the code for the user config on NixOS? Shouldn't the config be placed into the users home directory?

Stunkymonkey commented 8 months ago

why is this not implemented with ExtensionContext.globalState/ExtensionContext.globalStorageUri? Feels for me like the perfect fit.

Stunkymonkey commented 8 months ago

@equinusocio we could replace https://github.com/material-theme/vsc-material-theme/blob/main/src/core/extension-manager.ts#L47

posix.join(extensionFolderUri.path, USER_CONFIG_FILE_NAME)

with

posix.join(ExtensionContext.globalStorageUri.fsPath, USER_CONFIG_FILE_NAME)

But I think this would be a breaking change. see: #1295

equinusocio commented 8 months ago

Should not be a breaking change if we write/read the user config from the same place, so in the PR make sure to apply the change in every place we write or read it.

This is an internal mechanic that keeps user settings like theme accent and last installed version.

I can't help so much because I'm not the author of that code and ts is not really my thing. The whole code ts code is not maintained.

Stunkymonkey commented 8 months ago

@equinusocio I guess the PR already covers all places, where we read and write, because that is the only place USER_CONFIG_FILE_NAME is used.