Skip to content

Extension attempts to modify system-wide ZLS settings #398

Open
@mtlynch

Description

When the Zig extension prompts me to install ZLS, if I say yes, it attempts to write to ~/.confg/Code/user/settings.json, which is the system-wide config file for VS Code.

On my system, this doesn't work because I manage my home directory with Home Manager, so the settings.json file is read-only.

Repro steps

  1. Make ~/.confg/Code/user/settings.jsonread-only
  2. Open VS Code in an empty directory
  3. Install ZIg VS Code extension
  4. From command pallette, choose "Zig Setup: Install Zig"
  5. Choose latest version of Zig
  6. When prompted, choose to install ZLS

Expected behavior

Extension installs ZLS successfully and enables it within VS Code.

I'd prefer that it write to the project-local .vscode/settings.json rather than the system-wide version, but failing that, I'd like it to at least fail over to the project-local settings one when it can't write the system-wide settings.json.

Actual behavior

Installation fails with this message:

Failed to install Zig 0.14.0-dev.3220: Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again.

Workaround

Add this line to .vscode/settings.json in the local project:

"zig.zls.enabled": "on"

Then reload VS Code.

Environment

  • OS: NixOS 24.11 (Linux 6.12.12)
  • VS Code: 1.97.0
  • Zig VS Code Extension: 0.6.4
  • Architecture: AMD64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions