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
48.9k stars 2.94k forks source link

Zed puts stuff into $XDG_CONFIG_HOME that doesn't belong there (macOS) #14221

Open injust opened 3 months ago

injust commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Tracking issue for macOS specifically.

This supersedes https://github.com/zed-industries/zed/issues/9308, which was closed after https://github.com/zed-industries/zed/pull/10808 implemented XDG_BASE_DIR support for Linux and Windows.


[copied from #9308]

From what I understand, XDG_CONFIG_HOME is for configuration files, like settings.json and keybindings.json and tasks.json.

Zed misuses that directory to place some autogenerated files and directories in there:

$ tree -a ~/.config/zed
zed
├── .tmpgQCsHZ
├── conversations
├── embeddings
│   └── stable
│       ├── embeddings_db
│       ├── embeddings_db-shm
│       └── embeddings_db-wal
├── keymap.json
├── settings.json
└── themes

I think stuff like embeddings with some generated databases, and a random directory like .tmpgQCsHZ doesn't belong to XDG_DATA_HOME.

Environment

[copied from #9308]

Zed: v0.126.2 (Zed) OS: macOS 14.4.0 Memory: 16 GiB Architecture: aarch64

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

No response

If applicable, attach your Zed.log file to this issue.

No response

notpeter commented 3 months ago

The temporary files thing is a duplicate of #7155 which was fixed by:

It is available in Zed Preview now and will be in Zed Stable next Wednesday (2024-07-17). Those .tmpZZZZZ files are to allow inspection of telemetry data and we've moved them to where we store cache/transient state under ~/Library/Caches/dev.zed.Zed. They can be safely deleted.

As for the others (embeddings, conversations) there's definitely an argument to be made that they aren't strictly configuration and are application state so perhaps they should be moved under ~/Library/Application Support/Zed/. I believe everything there can also be safely re-created, but for things like conversations the current location is the only place they are preserved (cannot be recreated).

injust commented 3 months ago

As for the others (embeddings, conversations) there's definitely an argument to be made that they aren't strictly configuration and are application state so perhaps they should be moved under ~/Library/Application Support/Zed/.

+1 This sounds reasonable to me

injust commented 3 months ago

Those .tmpZZZZZ files are to allow inspection of telemetry data and we've moved them to where we store cache/transient state under ~/Library/Caches/dev.zed.Zed. They can be safely deleted.

@notpeter Tangential to this issue, but are those .tmp* files meant to be cleaned up by Zed? I don't think I've seen them disappear except when manually rm'd.

Also, since they're telemetry-related, should they be created when telemetry is completely disabled? They're all empty files for me.

pantheraleo-7 commented 3 months ago

Also, since they're telemetry-related, should they be created when telemetry is completely disabled? They're all empty files for me.

I second this. They shouldn't be created at all if telemetry is completely disabled

notpeter commented 2 months ago

@injust I'm sure this is unintentional, but would it be possible for you to stop recreating your Zed: Add gitignore commits with references to this issue? You've got 20 orphan commits and each one spams this issue with a reference.

injust commented 2 months ago

@injust I'm sure this is unintentional, but would it be possible for you to stop recreating your Zed: Add gitignore commits with references to this issue? You've got 20 orphan commits and each one spams this issue with a reference.

Ugh...sorry. It's doing that every time I rewrite history 😭 And it seems like GitHub just doesn't GC orphaned commits.

I nuked the repo and re-pushed it, which did the trick (albeit a bit of a nuclear option).

bartekpacia commented 2 months ago

I'd like to add that there are more files that are placed in $XDG_CONFIG_HOME, but don't belong there:

/Users/bartek/.config/zed
├── .DS_Store
├── .tmp0F75p0
├── .tmp0zp7jP
├── .tmp11EMCd
├── .tmp2Matoj
├── .tmp2wqCBH
├── .tmp3GfqU1
├── .tmp3ZRxSM
├── .tmp6Xw4rq
├── .tmp8cTJvj
├── .tmp8vywU1
├── .tmp9Vhfsl
├── .tmp9hXTLW
├── .tmpCqUP80
├── .tmpF2DjZh
├── .tmpIUZIsU
├── .tmpJIhbmy
├── .tmpJqxNvP
├── .tmpKTTMXC
├── .tmpMS22AU
├── .tmpMla6mR
├── .tmpN5FULY
├── .tmpNbTCd9
├── .tmpNcNmE0
├── .tmpNxNpFF
├── .tmpQ2jY8b
├── .tmpS55Zvy
├── .tmpSncbfO
├── .tmpU0fx4o
├── .tmpU3yTO5
├── .tmpY3nddT
├── .tmpYJV55M
├── .tmpauVytT
├── .tmpcvzzxJ
├── .tmpdAGViO
├── .tmpebEXQa
├── .tmpgOx0N6
├── .tmpgp7kUL
├── .tmphrWlBE
├── .tmpiGDPUQ
├── .tmpiRNAUz
├── .tmpl8QOUD
├── .tmplP1v8i
├── .tmpm86H8X
├── .tmpnYCqOK
├── .tmpniHxCd
├── .tmpocvesQ
├── .tmppqyQCH
├── .tmpqRRGGk
├── .tmprc9aTd
├── .tmptdUfya
├── .tmpubVnPC
├── .tmpvJ5EA9
├── .tmpvxRPVO
├── .tmpwdsKQY
├── .tmpwfelY3
├── .tmpySdu8K
├── .tmpzzj2EK
├── conversations
│   ├── Beginner Solving 3n + 1 Problem - 2.zed.json
│   └── images
├── embeddings
│   └── semantic-index-db.0.mdb
│       ├── data.mdb
│       └── lock.mdb
├── keymap.json
├── prompts
│   └── prompts-library-db.0.mdb
│       ├── data.mdb
│       └── lock.mdb
├── settings.json
└── themes

8 directories, 65 files

Most of this definitely doesn't belong in $XDG_CONFIG_HOME, but in $XDG_STATE_HOME or something like that.

jjt commented 1 week ago

As for the others (embeddings, conversations) there's definitely an argument to be made that they aren't strictly configuration and are application state so perhaps they should be moved under ~/Library/Application Support/Zed/

+1 from a macos user who likes a clean $XDG_CONFIG_HOME