Add glob support for custom file type language (#12043)

Release Notes:

- Added glob support for file_types configuration
([#10765](https://github.com/zed-industries/zed/issues/10765)).

`file_types` can now be written like this:

```json
"file_types": {
  "Dockerfile": [
    "Dockerfile",
    "Dockerfile.*",
  ]
}
```
This commit is contained in:
Joshua Farayola 2024-05-20 09:13:35 +01:00 committed by GitHub
parent 4e935f9f0f
commit ab7ce32888
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 15 deletions

View file

@ -651,18 +651,19 @@ The result is still `)))` and not `))))))`, which is what it would be by default
## File Types
- Setting: `file_types`
- Description: Configure how Zed selects a language for a file based on its filename or extension.
- Description: Configure how Zed selects a language for a file based on its filename or extension. Supports glob entries.
- Default: `{}`
**Examples**
To interpret all `.c` files as C++, and files called `MyLockFile` as TOML:
To interpret all `.c` files as C++, files called `MyLockFile` as TOML and files starting with `Dockerfile` as Dockerfile:
```json
{
"file_types": {
"C++": ["c"],
"TOML": ["MyLockFile"]
"TOML": ["MyLockFile"],
"Dockerfile": ["Dockerfile*"]
}
}
```