# Autocomplete language names in \`file_types\` setting \(\#58595\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e80cdd2ff732be0f6783b8ae94bd19817b2a320e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e80cdd2ff732be0f6783b8ae94bd19817b2a320e

Requested commit: e80cdd2ff732be0f6783b8ae94bd19817b2a320e

Commit: e80cdd2ff732be0f6783b8ae94bd19817b2a320e

Tree: dc8ba37f990c386b5814ccce8d809992b92861a6

Author: saberoueslati

Committer: GitHub

## Message

```
Autocomplete language names in `file_types` setting (#58595)

## Context

Closes #58571

When editing `settings.json`, typing a new key under `languages`
triggers language-name autocomplete. The same did not work for
`file_types`, even though both keys map language names to configuration.

The root cause: the JSON schema generator uses `replace_subschema` to
inject installed language names as the allowed properties of a named
type. The `languages` field backed by `LanguageToSettingsMap` (a named
newtype) got this treatment; `file_types` was backed by a raw
`HashMap<Arc<str>, ExtendingVec<String>>` with no named type to target.

The fix introduces a `FileTypeMap` newtype parallel to
`LanguageToSettingsMap` and wires it into the same schema-injection
path.

Video of manual test below :

[Screencast from 2026-06-05
00-04-16.webm](https://github.com/user-attachments/assets/5d8afb60-d566-4c99-ad2a-66ebbb47ed2e)

## How to Review

- `crates/settings_content/src/language.rs` : Adds
`FileTypeMap(HashMap<Arc<str>, ExtendingVec<String>>)` with the full set
of derives (`Debug`, `Clone`, `Default`, `PartialEq`, `Serialize`,
`Deserialize`, `JsonSchema`, `MergeFrom`) and an `IntoIterator for
&FileTypeMap` impl so existing call sites
(`all_languages.file_types.iter().flatten()`) continue to work without
changes. Changes the `file_types` field in `AllLanguageSettingsContent`
from the raw HashMap to `Option<FileTypeMap>`.

- `crates/settings/src/settings_store.rs` : In
`configure_schema_generator`, adds a `replace_subschema::<FileTypeMap>`
call mirroring the existing `LanguageToSettingsMap` one: injects
installed language names as the allowed properties, with
`ExtendingVec<String>` (array of glob patterns) as the value schema.
Adds `test_file_types_schema_generation` to verify the injected
properties.

- `crates/settings/src/vscode_import.rs` : Updates `file_types()` to
return `Option<FileTypeMap>` and wraps the constructed map accordingly.

- `crates/language/src/buffer_tests.rs` : Updates the existing custom
`file_types` test setup to extend the inner map of the new `FileTypeMap`
wrapper explicitly, keeping the language crate test build passing after
the type change.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

**Release Notes :**

- Fixed language name autocomplete not working in the `file_types`
setting

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

- [29565849be88d6cdd0983469925de33635bf14a4](https://git.cafe/gitcafe/zed/commit/29565849be88d6cdd0983469925de33635bf14a4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e80cdd2ff732be0f6783b8ae94bd19817b2a320e?format=markdown)
