Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using this extension on a read-only filesystem #1294

Open
Stunkymonkey opened this issue Feb 19, 2024 · 4 comments
Open

using this extension on a read-only filesystem #1294

Stunkymonkey opened this issue Feb 19, 2024 · 4 comments

Comments

@Stunkymonkey
Copy link

Stunkymonkey commented Feb 19, 2024

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

  • copy the material-theme.config.json to user.material-theme.config.json

  • add the jq '.changelog.lastversion = "34.3.1"'.

  • resulting in

    user.material-theme.config.json

    {
      "accents": {
        "Acid Lime": "#C6FF00",
        "Blue": "#2979FF",
        "Breaking Bad": "#388E3C",
        "Bright Teal": "#64FFDA",
        "Cyan": "#00BCD4",
        "Graphite": "#616161",
        "Indigo": "#5C6BC0",
        "Lime": "#7CB342",
        "Orange": "#FF7042",
        "Pink": "#FF4081",
        "Purple": "#AB47BC",
        "Red": "#E57373",
        "Sky": "#84FFFF",
        "Tomato": "#F44336",
        "Teal": "#80CBC4",
        "Yellow": "#FFA000"
      },
      "accentsProperties": {
        "activityBarBadge.background": {
          "alpha": 100,
          "value": null
        },
        "activityBar.activeBorder": {
          "alpha": 100,
          "value": null
        },
        "list.activeSelectionForeground": {
          "alpha": 100,
          "value": null
        },
        "list.inactiveSelectionForeground": {
          "alpha": 100,
          "value": null
        },
        "list.highlightForeground": {
          "alpha": 100,
          "value": null
        },
        "scrollbarSlider.activeBackground": {
          "alpha": 50,
          "value": null
        },
        "editorSuggestWidget.highlightForeground": {
          "alpha": 100,
          "value": null
        },
        "textLink.foreground": {
          "alpha": 100,
          "value": null
        },
        "progressBar.background": {
          "alpha": 100,
          "value": null
        },
        "pickerGroup.foreground": {
          "alpha": 100,
          "value": null
        },
        "tab.activeBorder": {
          "alpha": 100,
          "value": null
        },
        "notificationLink.foreground": {
          "alpha": 100,
          "value": null
        },
        "editorWidget.resizeBorder": {
          "alpha": 100,
          "value": null
        },
        "editorWidget.border": {
          "alpha": 100,
          "value": null
        },
        "settings.modifiedItemIndicator": {
          "alpha": 100,
          "value": null
        },
        "settings.headerForeground": {
          "alpha": 100,
          "value": null
        },
        "panelTitle.activeBorder": {
          "alpha": 100,
          "value": null
        },
        "breadcrumb.activeSelectionForeground": {
          "alpha": 100,
          "value": null
        },
        "menu.selectionForeground": {
          "alpha": 100,
          "value": null
        },
        "menubar.selectionForeground": {
          "alpha": 100,
          "value": null
        },
        "editor.findMatchBorder": {
          "alpha": 100,
          "value": null
        },
        "selection.background": {
          "alpha": 40,
          "value": null
        },
        "statusBarItem.remoteBackground": {
          "alpha": 100,
          "value": null
        }
      },
      "changelog": {
        "lastversion": "34.3.1"
      }
    }
  • but the application still wants to write at https://github.com/material-theme/vsc-material-theme/blob/main/src/core/extension-manager.ts#L90.

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
Copy link
Author

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

@Stunkymonkey
Copy link
Author

@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
Copy link
Member

equinusocio commented Feb 26, 2024

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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants