Add a setting for custom associations between languages and files (#9290)
Closes #5178 Release Notes: - Added a `file_types` setting that can be used to associate languages with file names and file extensions. For example, to interpret all `.c` files as C++, and files called `MyLockFile` as TOML, add the following to `settings.json`: ```json { "file_types": { "C++": ["c"], "TOML": ["MyLockFile"] } } ``` As with most zed settings, this can be configured on a per-directory basis by including a local `.zed/settings.json` file in that directory. --------- Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
parent
77de5689a3
commit
724c19a223
30 changed files with 640 additions and 415 deletions
|
@ -46,7 +46,7 @@ use postage::{
|
|||
watch,
|
||||
};
|
||||
use serde::Serialize;
|
||||
use settings::{Settings, SettingsStore};
|
||||
use settings::{Settings, SettingsLocation, SettingsStore};
|
||||
use smol::channel::{self, Sender};
|
||||
use std::{
|
||||
any::Any,
|
||||
|
@ -352,7 +352,10 @@ impl Worktree {
|
|||
"file_scan_exclusions",
|
||||
);
|
||||
let new_private_files = path_matchers(
|
||||
WorktreeSettings::get(Some((cx.handle().entity_id().as_u64() as usize, &Path::new(""))), cx).private_files.as_deref(),
|
||||
WorktreeSettings::get(Some(settings::SettingsLocation {
|
||||
worktree_id: cx.handle().entity_id().as_u64() as usize,
|
||||
path: Path::new("")
|
||||
}), cx).private_files.as_deref(),
|
||||
"private_files",
|
||||
);
|
||||
|
||||
|
@ -408,7 +411,10 @@ impl Worktree {
|
|||
"file_scan_exclusions",
|
||||
),
|
||||
private_files: path_matchers(
|
||||
WorktreeSettings::get(Some((cx.handle().entity_id().as_u64() as usize, &Path::new(""))), cx).private_files.as_deref(),
|
||||
WorktreeSettings::get(Some(SettingsLocation {
|
||||
worktree_id: cx.handle().entity_id().as_u64() as usize,
|
||||
path: Path::new(""),
|
||||
}), cx).private_files.as_deref(),
|
||||
"private_files",
|
||||
),
|
||||
ignores_by_parent_abs_path: Default::default(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue