mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-04 06:34:26 +00:00
Moved settings_file.rs into settings crate. Should be ready to start now :D
This commit is contained in:
parent
0beb97547e
commit
5487f99ac7
7 changed files with 20 additions and 12 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -5060,8 +5060,11 @@ dependencies = [
|
|||
"anyhow",
|
||||
"assets",
|
||||
"collections",
|
||||
"fs",
|
||||
"futures",
|
||||
"gpui",
|
||||
"json_comments",
|
||||
"postage",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -40,7 +40,9 @@ use sum_tree::TreeMap;
|
|||
use text::operation_queue::OperationQueue;
|
||||
pub use text::{Buffer as TextBuffer, BufferSnapshot as TextBufferSnapshot, Operation as _, *};
|
||||
use theme::SyntaxTheme;
|
||||
use util::{RandomCharIter, TryFutureExt as _};
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
use util::RandomCharIter;
|
||||
use util::TryFutureExt as _;
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub use {tree_sitter_rust, tree_sitter_typescript};
|
||||
|
|
|
@ -14,10 +14,13 @@ test-support = []
|
|||
assets = { path = "../assets" }
|
||||
collections = { path = "../collections" }
|
||||
gpui = { path = "../gpui" }
|
||||
fs = { path = "../fs" }
|
||||
anyhow = "1.0.38"
|
||||
futures = "0.3"
|
||||
theme = { path = "../theme" }
|
||||
util = { path = "../util" }
|
||||
anyhow = "1.0.38"
|
||||
json_comments = "0.2"
|
||||
postage = { version = "0.4.1", features = ["futures-traits"] }
|
||||
schemars = "0.8"
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
mod keymap_file;
|
||||
pub mod settings_file;
|
||||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
use fs::Fs;
|
||||
use futures::StreamExt;
|
||||
use gpui::{executor, MutableAppContext};
|
||||
use postage::sink::Sink as _;
|
||||
use postage::{prelude::Stream, watch};
|
||||
use project::Fs;
|
||||
use serde::Deserialize;
|
||||
use settings::{parse_json_with_comments, KeymapFileContent, Settings, SettingsFileContent};
|
||||
|
||||
use std::{path::Path, sync::Arc, time::Duration};
|
||||
use theme::ThemeRegistry;
|
||||
use util::ResultExt;
|
||||
|
||||
use crate::{parse_json_with_comments, KeymapFileContent, Settings, SettingsFileContent};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WatchedJsonFile<T>(pub watch::Receiver<T>);
|
||||
|
||||
|
@ -77,7 +79,7 @@ pub fn watch_settings_file(
|
|||
|
||||
pub fn keymap_updated(content: KeymapFileContent, cx: &mut MutableAppContext) {
|
||||
cx.clear_bindings();
|
||||
settings::KeymapFileContent::load_defaults(cx);
|
||||
KeymapFileContent::load_defaults(cx);
|
||||
content.add_to_cx(cx).log_err();
|
||||
}
|
||||
|
||||
|
@ -105,8 +107,8 @@ pub fn watch_keymap_file(mut file: WatchedJsonFile<KeymapFileContent>, cx: &mut
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use project::FakeFs;
|
||||
use settings::{EditorSettings, SoftWrap};
|
||||
use crate::{EditorSettings, SoftWrap};
|
||||
use fs::FakeFs;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_watch_settings_files(cx: &mut gpui::TestAppContext) {
|
|
@ -32,13 +32,11 @@ use std::{env, ffi::OsStr, panic, path::PathBuf, sync::Arc, thread, time::Durati
|
|||
use terminal::terminal_container_view::{get_working_directory, TerminalContainer};
|
||||
|
||||
use fs::RealFs;
|
||||
use settings::settings_file::{watch_keymap_file, watch_settings_file, WatchedJsonFile};
|
||||
use theme::ThemeRegistry;
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use workspace::{self, AppState, ItemHandle, NewFile, OpenPaths, Workspace};
|
||||
use zed::{
|
||||
self, build_window_options, initialize_workspace, languages, menus,
|
||||
settings_file::{watch_keymap_file, watch_settings_file, WatchedJsonFile},
|
||||
};
|
||||
use zed::{self, build_window_options, initialize_workspace, languages, menus};
|
||||
|
||||
fn main() {
|
||||
let http = http::client();
|
||||
|
|
|
@ -2,7 +2,6 @@ mod feedback;
|
|||
pub mod languages;
|
||||
pub mod menus;
|
||||
pub mod paths;
|
||||
pub mod settings_file;
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub mod test;
|
||||
|
||||
|
|
Loading…
Reference in a new issue