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
|
@ -225,12 +225,14 @@ impl CopilotButton {
|
|||
let suggestion_anchor = editor.selections.newest_anchor().start;
|
||||
let language = snapshot.language_at(suggestion_anchor);
|
||||
let file = snapshot.file_at(suggestion_anchor).cloned();
|
||||
|
||||
self.editor_enabled = Some(
|
||||
file.as_ref().map(|file| !file.is_private()).unwrap_or(true)
|
||||
&& all_language_settings(self.file.as_ref(), cx)
|
||||
.copilot_enabled(language, file.as_ref().map(|file| file.path().as_ref())),
|
||||
);
|
||||
self.editor_enabled = {
|
||||
let file = file.as_ref();
|
||||
Some(
|
||||
file.map(|file| !file.is_private()).unwrap_or(true)
|
||||
&& all_language_settings(file, cx)
|
||||
.copilot_enabled(language, file.map(|file| file.path().as_ref())),
|
||||
)
|
||||
};
|
||||
self.language = language.cloned();
|
||||
self.file = file;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue