Compare commits
4 Commits
git-graph
...
static-rel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6946ad4e8 | ||
|
|
c9972c2972 | ||
|
|
afdc53fdb7 | ||
|
|
d2e5947cf3 |
@@ -38,7 +38,7 @@ use std::{
|
|||||||
cell::{Ref, RefCell},
|
cell::{Ref, RefCell},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, LazyLock, Mutex},
|
||||||
};
|
};
|
||||||
use util::{ResultExt as _, rel_path::RelPath};
|
use util::{ResultExt as _, rel_path::RelPath};
|
||||||
|
|
||||||
@@ -74,17 +74,19 @@ impl Column for DataType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const RULES_FILE_NAMES: [&str; 9] = [
|
static RULES_FILE_NAMES: LazyLock<[&RelPath; 9]> = LazyLock::new(|| {
|
||||||
".rules",
|
[
|
||||||
".cursorrules",
|
RelPath::unix(".rules").unwrap(),
|
||||||
".windsurfrules",
|
RelPath::unix(".cursorrules").unwrap(),
|
||||||
".clinerules",
|
RelPath::unix(".windsurfrules").unwrap(),
|
||||||
".github/copilot-instructions.md",
|
RelPath::unix(".clinerules").unwrap(),
|
||||||
"CLAUDE.md",
|
RelPath::unix(".github/copilot-instructions.md").unwrap(),
|
||||||
"AGENT.md",
|
RelPath::unix("CLAUDE.md").unwrap(),
|
||||||
"AGENTS.md",
|
RelPath::unix("AGENT.md").unwrap(),
|
||||||
"GEMINI.md",
|
RelPath::unix("AGENTS.md").unwrap(),
|
||||||
];
|
RelPath::unix("GEMINI.md").unwrap(),
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
pub fn init(fs: Arc<dyn Fs>, cx: &mut App) {
|
pub fn init(fs: Arc<dyn Fs>, cx: &mut App) {
|
||||||
ThreadsDatabase::init(fs, cx);
|
ThreadsDatabase::init(fs, cx);
|
||||||
@@ -232,11 +234,10 @@ impl ThreadStore {
|
|||||||
self.enqueue_system_prompt_reload();
|
self.enqueue_system_prompt_reload();
|
||||||
}
|
}
|
||||||
project::Event::WorktreeUpdatedEntries(_, items) => {
|
project::Event::WorktreeUpdatedEntries(_, items) => {
|
||||||
if items.iter().any(|(path, _, _)| {
|
if items
|
||||||
RULES_FILE_NAMES
|
.iter()
|
||||||
.iter()
|
.any(|(path, _, _)| RULES_FILE_NAMES.iter().any(|name| path.as_ref() == *name))
|
||||||
.any(|name| path.as_ref() == RelPath::unix(name).unwrap())
|
{
|
||||||
}) {
|
|
||||||
self.enqueue_system_prompt_reload();
|
self.enqueue_system_prompt_reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,7 +369,7 @@ impl ThreadStore {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|name| {
|
.filter_map(|name| {
|
||||||
worktree
|
worktree
|
||||||
.entry_for_path(RelPath::unix(name).unwrap())
|
.entry_for_path(name)
|
||||||
.filter(|entry| entry.is_file())
|
.filter(|entry| entry.is_file())
|
||||||
.map(|entry| entry.path.clone())
|
.map(|entry| entry.path.clone())
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,21 +25,23 @@ use std::any::Any;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::{Arc, LazyLock};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
use util::rel_path::RelPath;
|
use util::rel_path::RelPath;
|
||||||
|
|
||||||
const RULES_FILE_NAMES: [&str; 9] = [
|
static RULES_FILE_NAMES: LazyLock<[&RelPath; 9]> = LazyLock::new(|| {
|
||||||
".rules",
|
[
|
||||||
".cursorrules",
|
RelPath::unix(".rules").unwrap(),
|
||||||
".windsurfrules",
|
RelPath::unix(".cursorrules").unwrap(),
|
||||||
".clinerules",
|
RelPath::unix(".windsurfrules").unwrap(),
|
||||||
".github/copilot-instructions.md",
|
RelPath::unix(".clinerules").unwrap(),
|
||||||
"CLAUDE.md",
|
RelPath::unix(".github/copilot-instructions.md").unwrap(),
|
||||||
"AGENT.md",
|
RelPath::unix("CLAUDE.md").unwrap(),
|
||||||
"AGENTS.md",
|
RelPath::unix("AGENT.md").unwrap(),
|
||||||
"GEMINI.md",
|
RelPath::unix("AGENTS.md").unwrap(),
|
||||||
];
|
RelPath::unix("GEMINI.md").unwrap(),
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
pub struct RulesLoadingError {
|
pub struct RulesLoadingError {
|
||||||
pub message: SharedString,
|
pub message: SharedString,
|
||||||
@@ -475,7 +477,7 @@ impl NativeAgent {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|name| {
|
.filter_map(|name| {
|
||||||
worktree
|
worktree
|
||||||
.entry_for_path(RelPath::unix(name).unwrap())
|
.entry_for_path(name)
|
||||||
.filter(|entry| entry.is_file())
|
.filter(|entry| entry.is_file())
|
||||||
.map(|entry| entry.path.clone())
|
.map(|entry| entry.path.clone())
|
||||||
})
|
})
|
||||||
@@ -556,11 +558,10 @@ impl NativeAgent {
|
|||||||
self.project_context_needs_refresh.send(()).ok();
|
self.project_context_needs_refresh.send(()).ok();
|
||||||
}
|
}
|
||||||
project::Event::WorktreeUpdatedEntries(_, items) => {
|
project::Event::WorktreeUpdatedEntries(_, items) => {
|
||||||
if items.iter().any(|(path, _, _)| {
|
if items
|
||||||
RULES_FILE_NAMES
|
.iter()
|
||||||
.iter()
|
.any(|(path, _, _)| RULES_FILE_NAMES.iter().any(|name| path.as_ref() == *name))
|
||||||
.any(|name| path.as_ref() == RelPath::unix(name).unwrap())
|
{
|
||||||
}) {
|
|
||||||
self.project_context_needs_refresh.send(()).ok();
|
self.project_context_needs_refresh.send(()).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::OnceLock;
|
use std::sync::{LazyLock, OnceLock};
|
||||||
|
|
||||||
pub use util::paths::home_dir;
|
pub use util::paths::home_dir;
|
||||||
use util::rel_path::RelPath;
|
use util::rel_path::RelPath;
|
||||||
@@ -31,12 +31,16 @@ static CONFIG_DIR: OnceLock<PathBuf> = OnceLock::new();
|
|||||||
|
|
||||||
/// Returns the relative path to the zed_server directory on the ssh host.
|
/// Returns the relative path to the zed_server directory on the ssh host.
|
||||||
pub fn remote_server_dir_relative() -> &'static RelPath {
|
pub fn remote_server_dir_relative() -> &'static RelPath {
|
||||||
RelPath::unix(".zed_server").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".zed_server").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the relative path to the zed_wsl_server directory on the wsl host.
|
/// Returns the relative path to the zed_wsl_server directory on the wsl host.
|
||||||
pub fn remote_wsl_server_dir_relative() -> &'static RelPath {
|
pub fn remote_wsl_server_dir_relative() -> &'static RelPath {
|
||||||
RelPath::unix(".zed_wsl_server").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".zed_wsl_server").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets a custom directory for all user data, overriding the default data directory.
|
/// Sets a custom directory for all user data, overriding the default data directory.
|
||||||
@@ -410,17 +414,23 @@ pub fn local_vscode_folder_name() -> &'static str {
|
|||||||
|
|
||||||
/// 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 RelPath {
|
pub fn local_settings_file_relative_path() -> &'static RelPath {
|
||||||
RelPath::unix(".zed/settings.json").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".zed/settings.json").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the relative path to a `tasks.json` file within a project.
|
/// Returns the relative path to a `tasks.json` file within a project.
|
||||||
pub fn local_tasks_file_relative_path() -> &'static RelPath {
|
pub fn local_tasks_file_relative_path() -> &'static RelPath {
|
||||||
RelPath::unix(".zed/tasks.json").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".zed/tasks.json").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the relative path to a `.vscode/tasks.json` file within a project.
|
/// Returns the relative path to a `.vscode/tasks.json` file within a project.
|
||||||
pub fn local_vscode_tasks_file_relative_path() -> &'static RelPath {
|
pub fn local_vscode_tasks_file_relative_path() -> &'static RelPath {
|
||||||
RelPath::unix(".vscode/tasks.json").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".vscode/tasks.json").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_task_file_name() -> &'static str {
|
pub fn debug_task_file_name() -> &'static str {
|
||||||
@@ -434,12 +444,16 @@ pub fn task_file_name() -> &'static str {
|
|||||||
/// Returns the relative path to a `debug.json` file within a project.
|
/// Returns the relative path to a `debug.json` file within a project.
|
||||||
/// .zed/debug.json
|
/// .zed/debug.json
|
||||||
pub fn local_debug_file_relative_path() -> &'static RelPath {
|
pub fn local_debug_file_relative_path() -> &'static RelPath {
|
||||||
RelPath::unix(".zed/debug.json").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".zed/debug.json").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the relative path to a `.vscode/launch.json` file within a project.
|
/// Returns the relative path to a `.vscode/launch.json` file within a project.
|
||||||
pub fn local_vscode_launch_file_relative_path() -> &'static RelPath {
|
pub fn local_vscode_launch_file_relative_path() -> &'static RelPath {
|
||||||
RelPath::unix(".vscode/launch.json").unwrap()
|
static CACHED: LazyLock<&'static RelPath> =
|
||||||
|
LazyLock::new(|| RelPath::unix(".vscode/launch.json").unwrap());
|
||||||
|
*CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn user_ssh_config_file() -> PathBuf {
|
pub fn user_ssh_config_file() -> PathBuf {
|
||||||
|
|||||||
Reference in New Issue
Block a user