mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-16 17:07:14 +03:00
settings: Load .zed/settings.json
even if .gitignored (#13370)
This fixes #4432 by ensuring that we scan & watch the `.zed` folder, just like we watch the `.git`, for changes. Release Notes: - Settings are now loaded from local `.zed/settings.json` files even if they are `.gitignore`d. ([#4432](https://github.com/zed-industries/zed/issues/4432)). Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
4072ad2858
commit
6b04b668ad
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -13082,6 +13082,7 @@ dependencies = [
|
|||||||
"language",
|
"language",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
"paths",
|
||||||
"postage",
|
"postage",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
|
@ -224,6 +224,12 @@ pub fn default_prettier_dir() -> &'static PathBuf {
|
|||||||
DEFAULT_PRETTIER_DIR.get_or_init(|| support_dir().join("prettier"))
|
DEFAULT_PRETTIER_DIR.get_or_init(|| support_dir().join("prettier"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the relative path to a `.zed` folder within a project.
|
||||||
|
pub fn local_settings_folder_relative_path() -> &'static Path {
|
||||||
|
static LOCAL_SETTINGS_FOLDER_RELATIVE_PATH: OnceLock<&Path> = OnceLock::new();
|
||||||
|
LOCAL_SETTINGS_FOLDER_RELATIVE_PATH.get_or_init(|| Path::new(".zed"))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the relative path to a `settings.json` file within a project.
|
/// Returns the relative path to a `settings.json` file within a project.
|
||||||
pub fn local_settings_file_relative_path() -> &'static Path {
|
pub fn local_settings_file_relative_path() -> &'static Path {
|
||||||
static LOCAL_SETTINGS_FILE_RELATIVE_PATH: OnceLock<&Path> = OnceLock::new();
|
static LOCAL_SETTINGS_FILE_RELATIVE_PATH: OnceLock<&Path> = OnceLock::new();
|
||||||
|
@ -34,6 +34,7 @@ ignore.workspace = true
|
|||||||
language.workspace = true
|
language.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
parking_lot.workspace = true
|
parking_lot.workspace = true
|
||||||
|
paths.workspace = true
|
||||||
postage.workspace = true
|
postage.workspace = true
|
||||||
rpc.workspace = true
|
rpc.workspace = true
|
||||||
schemars.workspace = true
|
schemars.workspace = true
|
||||||
|
@ -31,6 +31,7 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
use ignore::IgnoreStack;
|
use ignore::IgnoreStack;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use paths::local_settings_folder_relative_path;
|
||||||
use postage::{
|
use postage::{
|
||||||
barrier,
|
barrier,
|
||||||
prelude::{Sink as _, Stream as _},
|
prelude::{Sink as _, Stream as _},
|
||||||
@ -2589,6 +2590,7 @@ impl BackgroundScannerState {
|
|||||||
fn should_scan_directory(&self, entry: &Entry) -> bool {
|
fn should_scan_directory(&self, entry: &Entry) -> bool {
|
||||||
(!entry.is_external && !entry.is_ignored)
|
(!entry.is_external && !entry.is_ignored)
|
||||||
|| entry.path.file_name() == Some(*DOT_GIT)
|
|| entry.path.file_name() == Some(*DOT_GIT)
|
||||||
|
|| entry.path.file_name() == Some(local_settings_folder_relative_path().as_os_str())
|
||||||
|| self.scanned_dirs.contains(&entry.id) // If we've ever scanned it, keep scanning
|
|| self.scanned_dirs.contains(&entry.id) // If we've ever scanned it, keep scanning
|
||||||
|| self
|
|| self
|
||||||
.paths_to_scan
|
.paths_to_scan
|
||||||
|
Loading…
Reference in New Issue
Block a user