catchup with main
This commit is contained in:
commit
0ac919f6e0
112 changed files with 4590 additions and 1029 deletions
|
@ -40,6 +40,7 @@ pub fn init(languages: Arc<LanguageRegistry>, node_runtime: Arc<NodeRuntime>) {
|
|||
languages.register(name, load_config(name), grammar, adapters, load_queries)
|
||||
};
|
||||
|
||||
language("bash", tree_sitter_bash::language(), vec![]);
|
||||
language(
|
||||
"c",
|
||||
tree_sitter_c::language(),
|
||||
|
@ -151,6 +152,8 @@ pub fn init(languages: Arc<LanguageRegistry>, node_runtime: Arc<NodeRuntime>) {
|
|||
tree_sitter_php::language(),
|
||||
vec![Arc::new(php::IntelephenseLspAdapter::new(node_runtime))],
|
||||
);
|
||||
language("elm", tree_sitter_elm::language(), vec![]);
|
||||
language("glsl", tree_sitter_glsl::language(), vec![]);
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
|
|
3
crates/zed/src/languages/bash/brackets.scm
Normal file
3
crates/zed/src/languages/bash/brackets.scm
Normal file
|
@ -0,0 +1,3 @@
|
|||
("(" @open ")" @close)
|
||||
("[" @open "]" @close)
|
||||
("{" @open "}" @close)
|
8
crates/zed/src/languages/bash/config.toml
Normal file
8
crates/zed/src/languages/bash/config.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
name = "Shell Script"
|
||||
path_suffixes = [".sh", ".bash", ".bashrc", ".bash_profile", ".bash_aliases", ".bash_logout", ".profile", ".zsh", ".zshrc", ".zshenv", ".zsh_profile", ".zsh_aliases", ".zsh_histfile", ".zlogin"]
|
||||
first_line_pattern = "^#!.*\\b(?:ba|z)?sh\\b"
|
||||
brackets = [
|
||||
{ start = "[", end = "]", close = true, newline = false },
|
||||
{ start = "(", end = ")", close = true, newline = false },
|
||||
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },
|
||||
]
|
58
crates/zed/src/languages/bash/highlights.scm
Normal file
58
crates/zed/src/languages/bash/highlights.scm
Normal file
|
@ -0,0 +1,58 @@
|
|||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
(heredoc_body)
|
||||
(heredoc_start)
|
||||
] @string
|
||||
|
||||
(command_name) @function
|
||||
|
||||
(variable_name) @property
|
||||
|
||||
[
|
||||
"case"
|
||||
"do"
|
||||
"done"
|
||||
"elif"
|
||||
"else"
|
||||
"esac"
|
||||
"export"
|
||||
"fi"
|
||||
"for"
|
||||
"function"
|
||||
"if"
|
||||
"in"
|
||||
"select"
|
||||
"then"
|
||||
"unset"
|
||||
"until"
|
||||
"while"
|
||||
"local"
|
||||
"declare"
|
||||
] @keyword
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(function_definition name: (word) @function)
|
||||
|
||||
(file_descriptor) @number
|
||||
|
||||
[
|
||||
(command_substitution)
|
||||
(process_substitution)
|
||||
(expansion)
|
||||
]@embedded
|
||||
|
||||
[
|
||||
"$"
|
||||
"&&"
|
||||
">"
|
||||
">>"
|
||||
"<"
|
||||
"|"
|
||||
] @operator
|
||||
|
||||
(
|
||||
(command (_) @constant)
|
||||
(#match? @constant "^-")
|
||||
)
|
11
crates/zed/src/languages/elm/config.toml
Normal file
11
crates/zed/src/languages/elm/config.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
name = "Elm"
|
||||
path_suffixes = ["elm"]
|
||||
line_comment = "-- "
|
||||
block_comment = ["{- ", " -}"]
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "(", end = ")", close = true, newline = true },
|
||||
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
|
||||
{ start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
||||
]
|
72
crates/zed/src/languages/elm/highlights.scm
Normal file
72
crates/zed/src/languages/elm/highlights.scm
Normal file
|
@ -0,0 +1,72 @@
|
|||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"let"
|
||||
"in"
|
||||
(case)
|
||||
(of)
|
||||
(backslash)
|
||||
(as)
|
||||
(port)
|
||||
(exposing)
|
||||
(alias)
|
||||
(import)
|
||||
(module)
|
||||
(type)
|
||||
(arrow)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
(eq)
|
||||
(operator_identifier)
|
||||
(colon)
|
||||
] @operator
|
||||
|
||||
(type_annotation(lower_case_identifier) @function)
|
||||
(port_annotation(lower_case_identifier) @function)
|
||||
(function_declaration_left(lower_case_identifier) @function.definition)
|
||||
|
||||
(function_call_expr
|
||||
target: (value_expr
|
||||
name: (value_qid (lower_case_identifier) @function)))
|
||||
|
||||
(exposed_value(lower_case_identifier) @function)
|
||||
(exposed_type(upper_case_identifier) @type)
|
||||
|
||||
(field_access_expr(value_expr(value_qid)) @identifier)
|
||||
(lower_pattern) @variable
|
||||
(record_base_identifier) @identifier
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"|"
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
(number_constant_expr) @constant
|
||||
|
||||
(type_declaration(upper_case_identifier) @type)
|
||||
(type_ref) @type
|
||||
(type_alias_declaration name: (upper_case_identifier) @type)
|
||||
|
||||
(value_expr(upper_case_qid(upper_case_identifier)) @type)
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
|
||||
(string_escape) @string.escape
|
||||
|
||||
[
|
||||
(open_quote)
|
||||
(close_quote)
|
||||
(regular_string_part)
|
||||
(open_char)
|
||||
(close_char)
|
||||
] @string
|
2
crates/zed/src/languages/elm/injections.scm
Normal file
2
crates/zed/src/languages/elm/injections.scm
Normal file
|
@ -0,0 +1,2 @@
|
|||
((glsl_content) @content
|
||||
(#set! "language" "glsl"))
|
22
crates/zed/src/languages/elm/outline.scm
Normal file
22
crates/zed/src/languages/elm/outline.scm
Normal file
|
@ -0,0 +1,22 @@
|
|||
(type_declaration
|
||||
(type) @context
|
||||
(upper_case_identifier) @name) @item
|
||||
|
||||
(type_alias_declaration
|
||||
(type) @context
|
||||
(alias) @context
|
||||
name: (upper_case_identifier) @name) @item
|
||||
|
||||
(type_alias_declaration
|
||||
typeExpression:
|
||||
(type_expression
|
||||
part: (record_type
|
||||
(field_type
|
||||
name: (lower_case_identifier) @name) @item)))
|
||||
|
||||
(union_variant
|
||||
name: (upper_case_identifier) @name) @item
|
||||
|
||||
(value_declaration
|
||||
functionDeclarationLeft:
|
||||
(function_declaration_left(lower_case_identifier) @name)) @item
|
9
crates/zed/src/languages/glsl/config.toml
Normal file
9
crates/zed/src/languages/glsl/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
name = "GLSL"
|
||||
path_suffixes = ["vert", "frag", "tesc", "tese", "geom", "comp"]
|
||||
line_comment = "// "
|
||||
block_comment = ["/* ", " */"]
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "(", end = ")", close = true, newline = true },
|
||||
]
|
118
crates/zed/src/languages/glsl/highlights.scm
Normal file
118
crates/zed/src/languages/glsl/highlights.scm
Normal file
|
@ -0,0 +1,118 @@
|
|||
"break" @keyword
|
||||
"case" @keyword
|
||||
"const" @keyword
|
||||
"continue" @keyword
|
||||
"default" @keyword
|
||||
"do" @keyword
|
||||
"else" @keyword
|
||||
"enum" @keyword
|
||||
"extern" @keyword
|
||||
"for" @keyword
|
||||
"if" @keyword
|
||||
"inline" @keyword
|
||||
"return" @keyword
|
||||
"sizeof" @keyword
|
||||
"static" @keyword
|
||||
"struct" @keyword
|
||||
"switch" @keyword
|
||||
"typedef" @keyword
|
||||
"union" @keyword
|
||||
"volatile" @keyword
|
||||
"while" @keyword
|
||||
|
||||
"#define" @keyword
|
||||
"#elif" @keyword
|
||||
"#else" @keyword
|
||||
"#endif" @keyword
|
||||
"#if" @keyword
|
||||
"#ifdef" @keyword
|
||||
"#ifndef" @keyword
|
||||
"#include" @keyword
|
||||
(preproc_directive) @keyword
|
||||
|
||||
"--" @operator
|
||||
"-" @operator
|
||||
"-=" @operator
|
||||
"->" @operator
|
||||
"=" @operator
|
||||
"!=" @operator
|
||||
"*" @operator
|
||||
"&" @operator
|
||||
"&&" @operator
|
||||
"+" @operator
|
||||
"++" @operator
|
||||
"+=" @operator
|
||||
"<" @operator
|
||||
"==" @operator
|
||||
">" @operator
|
||||
"||" @operator
|
||||
|
||||
"." @delimiter
|
||||
";" @delimiter
|
||||
|
||||
(string_literal) @string
|
||||
(system_lib_string) @string
|
||||
|
||||
(null) @constant
|
||||
(number_literal) @number
|
||||
(char_literal) @number
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.special)
|
||||
|
||||
(field_identifier) @property
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type
|
||||
(sized_type_specifier) @type
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(comment) @comment
|
||||
; inherits: c
|
||||
|
||||
[
|
||||
"in"
|
||||
"out"
|
||||
"inout"
|
||||
"uniform"
|
||||
"shared"
|
||||
"layout"
|
||||
"attribute"
|
||||
"varying"
|
||||
"buffer"
|
||||
"coherent"
|
||||
"readonly"
|
||||
"writeonly"
|
||||
"precision"
|
||||
"highp"
|
||||
"mediump"
|
||||
"lowp"
|
||||
"centroid"
|
||||
"sample"
|
||||
"patch"
|
||||
"smooth"
|
||||
"flat"
|
||||
"noperspective"
|
||||
"invariant"
|
||||
"precise"
|
||||
] @type.qualifier
|
||||
|
||||
"subroutine" @keyword.function
|
||||
|
||||
(extension_storage_class) @storageclass
|
||||
|
||||
(
|
||||
(identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^gl_")
|
||||
)
|
|
@ -154,7 +154,7 @@ fn main() {
|
|||
file_finder::init(cx);
|
||||
outline::init(cx);
|
||||
project_symbols::init(cx);
|
||||
project_panel::init(cx);
|
||||
project_panel::init(Assets, cx);
|
||||
diagnostics::init(cx);
|
||||
search::init(cx);
|
||||
semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx);
|
||||
|
@ -166,6 +166,7 @@ fn main() {
|
|||
cx.spawn(|cx| watch_themes(fs.clone(), cx)).detach();
|
||||
cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))
|
||||
.detach();
|
||||
watch_file_types(fs.clone(), cx);
|
||||
|
||||
languages.set_theme(theme::current(cx).clone());
|
||||
cx.observe_global::<SettingsStore, _>({
|
||||
|
@ -685,6 +686,26 @@ async fn watch_languages(fs: Arc<dyn Fs>, languages: Arc<LanguageRegistry>) -> O
|
|||
Some(())
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
fn watch_file_types(fs: Arc<dyn Fs>, cx: &mut AppContext) {
|
||||
cx.spawn(|mut cx| async move {
|
||||
let mut events = fs
|
||||
.watch(
|
||||
"assets/icons/file_icons/file_types.json".as_ref(),
|
||||
Duration::from_millis(100),
|
||||
)
|
||||
.await;
|
||||
while (events.next().await).is_some() {
|
||||
cx.update(|cx| {
|
||||
cx.update_global(|file_types, _| {
|
||||
*file_types = project_panel::file_associations::FileAssociations::new(Assets);
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
.detach()
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
async fn watch_themes(_fs: Arc<dyn Fs>, _cx: AsyncAppContext) -> Option<()> {
|
||||
None
|
||||
|
@ -695,6 +716,9 @@ async fn watch_languages(_: Arc<dyn Fs>, _: Arc<LanguageRegistry>) -> Option<()>
|
|||
None
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
fn watch_file_types(fs: Arc<dyn Fs>, cx: &mut AppContext) {}
|
||||
|
||||
fn connect_to_cli(
|
||||
server_name: &str,
|
||||
) -> Result<(mpsc::Receiver<CliRequest>, IpcSender<CliResponse>)> {
|
||||
|
@ -895,7 +919,14 @@ pub fn dock_default_item_factory(
|
|||
})
|
||||
.notify_err(workspace, cx)?;
|
||||
|
||||
let terminal_view = cx.add_view(|cx| TerminalView::new(terminal, workspace.database_id(), cx));
|
||||
let terminal_view = cx.add_view(|cx| {
|
||||
TerminalView::new(
|
||||
terminal,
|
||||
workspace.weak_handle(),
|
||||
workspace.database_id(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
|
||||
Some(Box::new(terminal_view))
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ pub fn menus() -> Vec<Menu<'static>> {
|
|||
MenuItem::action("Toggle Left Dock", workspace::ToggleLeftDock),
|
||||
MenuItem::action("Toggle Right Dock", workspace::ToggleRightDock),
|
||||
MenuItem::action("Toggle Bottom Dock", workspace::ToggleBottomDock),
|
||||
MenuItem::action("Close All Docks", workspace::CloseAllDocks),
|
||||
MenuItem::submenu(Menu {
|
||||
name: "Editor Layout",
|
||||
items: vec![
|
||||
|
|
|
@ -315,6 +315,7 @@ pub fn initialize_workspace(
|
|||
workspace.status_bar().update(cx, |status_bar, cx| {
|
||||
status_bar.add_left_item(diagnostic_summary, cx);
|
||||
status_bar.add_left_item(activity_indicator, cx);
|
||||
|
||||
status_bar.add_right_item(feedback_button, cx);
|
||||
status_bar.add_right_item(copilot, cx);
|
||||
status_bar.add_right_item(active_buffer_language, cx);
|
||||
|
@ -338,9 +339,22 @@ pub fn initialize_workspace(
|
|||
let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
|
||||
let (project_panel, terminal_panel, assistant_panel) =
|
||||
futures::try_join!(project_panel, terminal_panel, assistant_panel)?;
|
||||
|
||||
workspace_handle.update(&mut cx, |workspace, cx| {
|
||||
let project_panel_position = project_panel.position(cx);
|
||||
workspace.add_panel(project_panel, cx);
|
||||
workspace.add_panel_with_extra_event_handler(
|
||||
project_panel,
|
||||
cx,
|
||||
|workspace, _, event, cx| match event {
|
||||
project_panel::Event::NewSearchInDirectory { dir_entry } => {
|
||||
search::ProjectSearchView::new_search_in_directory(workspace, dir_entry, cx)
|
||||
}
|
||||
project_panel::Event::ActivatePanel => {
|
||||
workspace.focus_panel::<ProjectPanel>(cx);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
);
|
||||
workspace.add_panel(terminal_panel, cx);
|
||||
workspace.add_panel(assistant_panel, cx);
|
||||
|
||||
|
@ -1085,8 +1099,46 @@ mod tests {
|
|||
)
|
||||
.await;
|
||||
|
||||
let project = Project::test(app_state.fs.clone(), ["/dir1".as_ref()], cx).await;
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
|
||||
cx.update(|cx| open_paths(&[PathBuf::from("/dir1/")], &app_state, None, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(cx.window_ids().len(), 1);
|
||||
let workspace = cx
|
||||
.read_window(cx.window_ids()[0], |cx| cx.root_view().clone())
|
||||
.unwrap()
|
||||
.downcast::<Workspace>()
|
||||
.unwrap();
|
||||
|
||||
#[track_caller]
|
||||
fn assert_project_panel_selection(
|
||||
workspace: &Workspace,
|
||||
expected_worktree_path: &Path,
|
||||
expected_entry_path: &Path,
|
||||
cx: &AppContext,
|
||||
) {
|
||||
let project_panel = [
|
||||
workspace.left_dock().read(cx).panel::<ProjectPanel>(),
|
||||
workspace.right_dock().read(cx).panel::<ProjectPanel>(),
|
||||
workspace.bottom_dock().read(cx).panel::<ProjectPanel>(),
|
||||
]
|
||||
.into_iter()
|
||||
.find_map(std::convert::identity)
|
||||
.expect("found no project panels")
|
||||
.read(cx);
|
||||
let (selected_worktree, selected_entry) = project_panel
|
||||
.selected_entry(cx)
|
||||
.expect("project panel should have a selected entry");
|
||||
assert_eq!(
|
||||
selected_worktree.abs_path().as_ref(),
|
||||
expected_worktree_path,
|
||||
"Unexpected project panel selected worktree path"
|
||||
);
|
||||
assert_eq!(
|
||||
selected_entry.path.as_ref(),
|
||||
expected_entry_path,
|
||||
"Unexpected project panel selected entry path"
|
||||
);
|
||||
}
|
||||
|
||||
// Open a file within an existing worktree.
|
||||
workspace
|
||||
|
@ -1095,9 +1147,10 @@ mod tests {
|
|||
})
|
||||
.await;
|
||||
cx.read(|cx| {
|
||||
let workspace = workspace.read(cx);
|
||||
assert_project_panel_selection(workspace, Path::new("/dir1"), Path::new("a.txt"), cx);
|
||||
assert_eq!(
|
||||
workspace
|
||||
.read(cx)
|
||||
.active_pane()
|
||||
.read(cx)
|
||||
.active_item()
|
||||
|
@ -1118,8 +1171,9 @@ mod tests {
|
|||
})
|
||||
.await;
|
||||
cx.read(|cx| {
|
||||
let workspace = workspace.read(cx);
|
||||
assert_project_panel_selection(workspace, Path::new("/dir2/b.txt"), Path::new(""), cx);
|
||||
let worktree_roots = workspace
|
||||
.read(cx)
|
||||
.worktrees(cx)
|
||||
.map(|w| w.read(cx).as_local().unwrap().abs_path().as_ref())
|
||||
.collect::<HashSet<_>>();
|
||||
|
@ -1132,7 +1186,6 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
workspace
|
||||
.read(cx)
|
||||
.active_pane()
|
||||
.read(cx)
|
||||
.active_item()
|
||||
|
@ -1153,8 +1206,9 @@ mod tests {
|
|||
})
|
||||
.await;
|
||||
cx.read(|cx| {
|
||||
let workspace = workspace.read(cx);
|
||||
assert_project_panel_selection(workspace, Path::new("/dir3"), Path::new("c.txt"), cx);
|
||||
let worktree_roots = workspace
|
||||
.read(cx)
|
||||
.worktrees(cx)
|
||||
.map(|w| w.read(cx).as_local().unwrap().abs_path().as_ref())
|
||||
.collect::<HashSet<_>>();
|
||||
|
@ -1167,7 +1221,6 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
workspace
|
||||
.read(cx)
|
||||
.active_pane()
|
||||
.read(cx)
|
||||
.active_item()
|
||||
|
@ -1188,8 +1241,9 @@ mod tests {
|
|||
})
|
||||
.await;
|
||||
cx.read(|cx| {
|
||||
let workspace = workspace.read(cx);
|
||||
assert_project_panel_selection(workspace, Path::new("/d.txt"), Path::new(""), cx);
|
||||
let worktree_roots = workspace
|
||||
.read(cx)
|
||||
.worktrees(cx)
|
||||
.map(|w| w.read(cx).as_local().unwrap().abs_path().as_ref())
|
||||
.collect::<HashSet<_>>();
|
||||
|
@ -1202,7 +1256,6 @@ mod tests {
|
|||
);
|
||||
|
||||
let visible_worktree_roots = workspace
|
||||
.read(cx)
|
||||
.visible_worktrees(cx)
|
||||
.map(|w| w.read(cx).as_local().unwrap().abs_path().as_ref())
|
||||
.collect::<HashSet<_>>();
|
||||
|
@ -1216,7 +1269,6 @@ mod tests {
|
|||
|
||||
assert_eq!(
|
||||
workspace
|
||||
.read(cx)
|
||||
.active_pane()
|
||||
.read(cx)
|
||||
.active_item()
|
||||
|
@ -2334,7 +2386,7 @@ mod tests {
|
|||
editor::init(cx);
|
||||
project_panel::init_settings(cx);
|
||||
pane::init(cx);
|
||||
project_panel::init(cx);
|
||||
project_panel::init((), cx);
|
||||
terminal_view::init(cx);
|
||||
ai::init(cx);
|
||||
app_state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue