zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.52k stars 3.13k forks source link

Support multiple user settings #20038

Open smsegal opened 3 weeks ago

smsegal commented 3 weeks ago

Check for existing issues

Describe the feature

It would be useful to support an includes directive in the settings json file. Particularly for the use-case of sharing configuration across different machines.

For example, with the Remote Development feature, I now have a bunch of work servers and project paths in my config file, which I share and sync across my work and personal machines.

If we could conditionally include other config files to extend the "base" config, I would be able to continue sharing my configuration between work/personal machines without irrelevant settings being shared.

I would imagine that this could work in a few ways:

  1. An "includes" key that takes a list of (relative?) paths to other files to include
  2. The same "includes" key, but could take a list of objects that might specify what to do if the file doesn't exist.

The settings in the included configurations should likely take precedence over all previous settings in a LIFO manner - such that if I include files A, B, C that include the same keys K, the values should be merged with C taking precedence over B and so on.

If applicable, add mockups / screenshots to help present your vision of the feature

Example settings file:

{
  # ... existing configuration
  "includes": [
   "work_settings.json",
  ],

  # or maybe
  "includes": [
    {
      "path": "./work_settings.json",
      "missing": "ok", # or "error",  etc
    }
  ]
}

Where "work_settings.json" might include:

{
  "ssh_connections": [
    {
      "host": "work-server",
      "projects": [
        {
          "paths": [
            "~/project"
          ]
        },
    }
  ]
}
notpeter commented 3 weeks ago

See also: