Add support for folder-specific settings (#2537)
This PR allows you to customize Zed's settings within a particular folder by creating a `.zed/settings.json` file within that folder. Todo * [x] respect folder-specific settings for local projects * [x] respect folder-specific settings in remote projects * [x] pass a path when retrieving editor/language settings * [x] pass a path when retrieving copilot settings * [ ] update the `Setting` trait to make it clear which types of settings are locally overridable Release Notes: * Added support for folder-specific settings. You can customize Zed's settings within a particular folder by creating a `.zed` directory and a `.zed/settings.json` file within that folder.
This commit is contained in:
commit
788f97ec68
27 changed files with 797 additions and 158 deletions
|
@ -135,7 +135,10 @@ impl LspAdapter for JsonLspAdapter {
|
|||
},
|
||||
"schemas": [
|
||||
{
|
||||
"fileMatch": [schema_file_match(&paths::SETTINGS)],
|
||||
"fileMatch": [
|
||||
schema_file_match(&paths::SETTINGS),
|
||||
&*paths::LOCAL_SETTINGS_RELATIVE_PATH,
|
||||
],
|
||||
"schema": settings_schema,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||
use futures::{future::BoxFuture, FutureExt, StreamExt};
|
||||
use gpui::AppContext;
|
||||
use language::{
|
||||
language_settings::language_settings, LanguageServerBinary, LanguageServerName, LspAdapter,
|
||||
language_settings::all_language_settings, LanguageServerBinary, LanguageServerName, LspAdapter,
|
||||
};
|
||||
use node_runtime::NodeRuntime;
|
||||
use serde_json::Value;
|
||||
|
@ -101,13 +101,16 @@ impl LspAdapter for YamlLspAdapter {
|
|||
}
|
||||
|
||||
fn workspace_configuration(&self, cx: &mut AppContext) -> Option<BoxFuture<'static, Value>> {
|
||||
let tab_size = all_language_settings(None, cx)
|
||||
.language(Some("YAML"))
|
||||
.tab_size;
|
||||
Some(
|
||||
future::ready(serde_json::json!({
|
||||
"yaml": {
|
||||
"keyOrdering": false
|
||||
},
|
||||
"[yaml]": {
|
||||
"editor.tabSize": language_settings(Some("YAML"), cx).tab_size,
|
||||
"editor.tabSize": tab_size,
|
||||
}
|
||||
}))
|
||||
.boxed(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue