settings: Fix VS Code import appending duplicate file associations (#61355)
Closes #56536
## What & why
Running `zed: import vs code settings` more than once kept re-adding the
same file extensions to `file_types`, so `files.associations` entries
grew without bound:
```json
"file_types": { "c": ["*.keymap", "*.keymap", "*.keymap"] }
```
The import merges the VS Code-derived settings into the user's existing
settings, and `file_types` values were `ExtendingVec`s, whose
`merge_from` appends every incoming value unconditionally.
Per review feedback, instead of changing `ExtendingVec`'s merge
semantics (it also backs ssh/wsl connections, `private_files`, etc.),
this adds a new `ExtendingSet` type that actually behaves like a set,
and switches `FileTypeMap`'s file associations to it:
- Backed by an insertion-order-preserving `IndexSet`, so users' pattern
order round-trips through the settings file unchanged (the import
machinery diffs serialized old/new content to produce edits; a sorted
set would reorder existing arrays).
- Merging only accumulates new values, so re-importing an
already-present association is a no-op.
- Since it's a real set, deserialization also collapses duplicates that
earlier imports already wrote into the settings file.
- `ExtendingVec` and all its other users are untouched.
## Testing
- Added a `test_vscode_import` case that re-imports an already-present
`files.associations` entry and asserts the extension isn't duplicated.
It fails before the change and passes after.
- `cargo test -p settings -p settings_content -p language` pass.
- `./script/clippy -p settings -p settings_content -p language -p
recent_projects -p json_schema_store` is clean.
Release Notes:
- Fixed importing VS Code settings repeatedly adding duplicate
`file_types` entries for `files.associations`.
---------
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
d47347d1aaIbrahim Khan committed on 7/24/2026, 12:54:58 AM· committed by GitHubparentfd8f0cd