catchup with main

This commit is contained in:
KCaverly 2023-10-23 17:21:37 +02:00
commit 0dfbfdd164
126 changed files with 5580 additions and 1807 deletions

View file

@ -53,6 +53,7 @@ language_selector = { path = "../language_selector" }
lsp = { path = "../lsp" }
language_tools = { path = "../language_tools" }
node_runtime = { path = "../node_runtime" }
notifications = { path = "../notifications" }
assistant = { path = "../assistant" }
outline = { path = "../outline" }
plugin_runtime = { path = "../plugin_runtime",optional = true }

View file

@ -469,6 +469,7 @@ fn main() {
.join("embeddings_db");
let languages = languages.clone();
let fs = fs.clone();
cx.spawn(|mut cx| async move {
let semantic_index = SemanticIndex::new(

View file

@ -76,7 +76,10 @@ pub fn init(
elixir::ElixirLspSetting::ElixirLs => language(
"elixir",
tree_sitter_elixir::language(),
vec![Arc::new(elixir::ElixirLspAdapter)],
vec![
Arc::new(elixir::ElixirLspAdapter),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
),
elixir::ElixirLspSetting::NextLs => language(
"elixir",
@ -101,7 +104,10 @@ pub fn init(
language(
"heex",
tree_sitter_heex::language(),
vec![Arc::new(elixir::ElixirLspAdapter)],
vec![
Arc::new(elixir::ElixirLspAdapter),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
);
language(
"json",
@ -167,7 +173,10 @@ pub fn init(
language(
"erb",
tree_sitter_embedded_template::language(),
vec![Arc::new(ruby::RubyLanguageServer)],
vec![
Arc::new(ruby::RubyLanguageServer),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
);
language("scheme", tree_sitter_scheme::language(), vec![]);
language("racket", tree_sitter_racket::language(), vec![]);
@ -184,16 +193,18 @@ pub fn init(
language(
"svelte",
tree_sitter_svelte::language(),
vec![Arc::new(svelte::SvelteLspAdapter::new(
node_runtime.clone(),
))],
vec![
Arc::new(svelte::SvelteLspAdapter::new(node_runtime.clone())),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
);
language(
"php",
tree_sitter_php::language(),
vec![Arc::new(php::IntelephenseLspAdapter::new(
node_runtime.clone(),
))],
vec![
Arc::new(php::IntelephenseLspAdapter::new(node_runtime.clone())),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
);
language("elm", tree_sitter_elm::language(), vec![]);

View file

@ -1,7 +1,7 @@
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use futures::StreamExt;
use language::{BundledFormatter, LanguageServerName, LspAdapter, LspAdapterDelegate};
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime;
use serde_json::json;
@ -96,10 +96,6 @@ impl LspAdapter for CssLspAdapter {
"provideFormatter": true
}))
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::prettier("css")]
}
}
async fn get_cached_server_binary(

View file

@ -10,3 +10,4 @@ brackets = [
]
word_characters = ["-"]
block_comment = ["/* ", " */"]
prettier_parser_name = "css"

View file

@ -9,3 +9,8 @@ brackets = [
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
{ start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
[overrides.string]
word_characters = ["-"]
opt_into_language_servers = ["tailwindcss-language-server"]

View file

@ -5,3 +5,4 @@ brackets = [
{ start = "<", end = ">", close = true, newline = true },
]
block_comment = ["<%#", "%>"]
scope_opt_in_language_servers = ["tailwindcss-language-server"]

View file

@ -5,3 +5,8 @@ brackets = [
{ start = "<", end = ">", close = true, newline = true },
]
block_comment = ["<%!-- ", " --%>"]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
[overrides.string]
word_characters = ["-"]
opt_into_language_servers = ["tailwindcss-language-server"]

View file

@ -0,0 +1,4 @@
[
(attribute_value)
(quoted_attribute_value)
] @string

View file

@ -1,7 +1,7 @@
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use futures::StreamExt;
use language::{BundledFormatter, LanguageServerName, LspAdapter, LspAdapterDelegate};
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime;
use serde_json::json;
@ -96,10 +96,6 @@ impl LspAdapter for HtmlLspAdapter {
"provideFormatter": true
}))
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::prettier("html")]
}
}
async fn get_cached_server_binary(

View file

@ -11,3 +11,4 @@ brackets = [
{ start = "!--", end = " --", close = true, newline = false, not_in = ["comment", "string"] },
]
word_characters = ["-"]
prettier_parser_name = "html"

View file

@ -15,6 +15,7 @@ brackets = [
]
word_characters = ["$", "#"]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
prettier_parser_name = "babel"
[overrides.element]
line_comment = { remove = true }

View file

@ -4,9 +4,7 @@ use collections::HashMap;
use feature_flags::FeatureFlagAppExt;
use futures::{future::BoxFuture, FutureExt, StreamExt};
use gpui::AppContext;
use language::{
BundledFormatter, LanguageRegistry, LanguageServerName, LspAdapter, LspAdapterDelegate,
};
use language::{LanguageRegistry, LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime;
use serde_json::json;
@ -146,10 +144,6 @@ impl LspAdapter for JsonLspAdapter {
async fn language_ids(&self) -> HashMap<String, String> {
[("JSON".into(), "jsonc".into())].into_iter().collect()
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::prettier("json")]
}
}
async fn get_cached_server_binary(

View file

@ -7,3 +7,4 @@ brackets = [
{ start = "[", end = "]", close = true, newline = true },
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
]
prettier_parser_name = "json"

View file

@ -11,3 +11,4 @@ brackets = [
]
collapsed_placeholder = "/* ... */"
word_characters = ["$"]
scope_opt_in_language_servers = ["tailwindcss-language-server"]

View file

@ -1,7 +1,7 @@
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use futures::StreamExt;
use language::{BundledFormatter, LanguageServerName, LspAdapter, LspAdapterDelegate};
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime;
use serde_json::json;
@ -96,11 +96,8 @@ impl LspAdapter for SvelteLspAdapter {
}))
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::Prettier {
parser_name: Some("svelte"),
plugin_names: vec!["prettier-plugin-svelte"],
}]
fn prettier_plugins(&self) -> &[&'static str] {
&["prettier-plugin-svelte"]
}
}

View file

@ -12,7 +12,9 @@ brackets = [
{ start = "`", end = "`", close = true, newline = false, not_in = ["string"] },
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
prettier_parser_name = "svelte"
[overrides.element]
line_comment = { remove = true }
block_comment = ["{/* ", " */}"]
[overrides.string]
word_characters = ["-"]
opt_into_language_servers = ["tailwindcss-language-server"]

View file

@ -0,0 +1,7 @@
(comment) @comment
[
(raw_text)
(attribute_value)
(quoted_attribute_value)
] @string

View file

@ -6,7 +6,7 @@ use futures::{
FutureExt, StreamExt,
};
use gpui::AppContext;
use language::{BundledFormatter, LanguageServerName, LspAdapter, LspAdapterDelegate};
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime;
use serde_json::{json, Value};
@ -117,22 +117,21 @@ impl LspAdapter for TailwindLspAdapter {
}
async fn language_ids(&self) -> HashMap<String, String> {
HashMap::from_iter(
[
("HTML".to_string(), "html".to_string()),
("CSS".to_string(), "css".to_string()),
("JavaScript".to_string(), "javascript".to_string()),
("TSX".to_string(), "typescriptreact".to_string()),
]
.into_iter(),
)
HashMap::from_iter([
("HTML".to_string(), "html".to_string()),
("CSS".to_string(), "css".to_string()),
("JavaScript".to_string(), "javascript".to_string()),
("TSX".to_string(), "typescriptreact".to_string()),
("Svelte".to_string(), "svelte".to_string()),
("Elixir".to_string(), "phoenix-heex".to_string()),
("HEEX".to_string(), "phoenix-heex".to_string()),
("ERB".to_string(), "erb".to_string()),
("PHP".to_string(), "php".to_string()),
])
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::Prettier {
parser_name: None,
plugin_names: vec!["prettier-plugin-tailwindcss"],
}]
fn prettier_plugins(&self) -> &[&'static str] {
&["prettier-plugin-tailwindcss"]
}
}

View file

@ -14,6 +14,7 @@ brackets = [
]
word_characters = ["#", "$"]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
prettier_parser_name = "typescript"
[overrides.element]
line_comment = { remove = true }

View file

@ -4,7 +4,7 @@ use async_tar::Archive;
use async_trait::async_trait;
use futures::{future::BoxFuture, FutureExt};
use gpui::AppContext;
use language::{BundledFormatter, LanguageServerName, LspAdapter, LspAdapterDelegate};
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::{CodeActionKind, LanguageServerBinary};
use node_runtime::NodeRuntime;
use serde_json::{json, Value};
@ -161,10 +161,6 @@ impl LspAdapter for TypeScriptLspAdapter {
"provideFormatter": true
}))
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::prettier("typescript")]
}
}
async fn get_cached_ts_server_binary(
@ -313,10 +309,6 @@ impl LspAdapter for EsLintLspAdapter {
async fn initialization_options(&self) -> Option<serde_json::Value> {
None
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::prettier("babel")]
}
}
async fn get_cached_eslint_server_binary(

View file

@ -13,3 +13,4 @@ brackets = [
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
]
word_characters = ["#", "$"]
prettier_parser_name = "typescript"

View file

@ -3,8 +3,7 @@ use async_trait::async_trait;
use futures::{future::BoxFuture, FutureExt, StreamExt};
use gpui::AppContext;
use language::{
language_settings::all_language_settings, BundledFormatter, LanguageServerName, LspAdapter,
LspAdapterDelegate,
language_settings::all_language_settings, LanguageServerName, LspAdapter, LspAdapterDelegate,
};
use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime;
@ -109,10 +108,6 @@ impl LspAdapter for YamlLspAdapter {
}))
.boxed()
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {
vec![BundledFormatter::prettier("yaml")]
}
}
async fn get_cached_server_binary(

View file

@ -9,3 +9,4 @@ brackets = [
]
increase_indent_pattern = ":\\s*[|>]?\\s*$"
prettier_parser_name = "yaml"

View file

@ -191,6 +191,7 @@ fn main() {
activity_indicator::init(cx);
language_tools::init(cx);
call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
notifications::init(app_state.client.clone(), app_state.user_store.clone(), cx);
collab_ui::init(&app_state, cx);
feedback::init(cx);
welcome::init(cx);

View file

@ -227,6 +227,13 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::AppContext) {
workspace.toggle_panel_focus::<collab_ui::chat_panel::ChatPanel>(cx);
},
);
cx.add_action(
|workspace: &mut Workspace,
_: &collab_ui::notification_panel::ToggleFocus,
cx: &mut ViewContext<Workspace>| {
workspace.toggle_panel_focus::<collab_ui::notification_panel::NotificationPanel>(cx);
},
);
cx.add_action(
|workspace: &mut Workspace,
_: &terminal_panel::ToggleFocus,
@ -281,9 +288,8 @@ pub fn initialize_workspace(
QuickActionBar::new(buffer_search_bar, workspace)
});
toolbar.add_item(quick_action_bar, cx);
let diagnostic_editor_controls = cx.add_view(|_| {
diagnostics::ToolbarControls::new()
});
let diagnostic_editor_controls =
cx.add_view(|_| diagnostics::ToolbarControls::new());
toolbar.add_item(diagnostic_editor_controls, cx);
let project_search_bar = cx.add_view(|_| ProjectSearchBar::new());
toolbar.add_item(project_search_bar, cx);
@ -357,12 +363,24 @@ pub fn initialize_workspace(
collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
let chat_panel =
collab_ui::chat_panel::ChatPanel::load(workspace_handle.clone(), cx.clone());
let (project_panel, terminal_panel, assistant_panel, channels_panel, chat_panel) = futures::try_join!(
let notification_panel = collab_ui::notification_panel::NotificationPanel::load(
workspace_handle.clone(),
cx.clone(),
);
let (
project_panel,
terminal_panel,
assistant_panel,
channels_panel,
chat_panel,
notification_panel,
) = futures::try_join!(
project_panel,
terminal_panel,
assistant_panel,
channels_panel,
chat_panel,
notification_panel,
)?;
workspace_handle.update(&mut cx, |workspace, cx| {
let project_panel_position = project_panel.position(cx);
@ -383,6 +401,7 @@ pub fn initialize_workspace(
workspace.add_panel(assistant_panel, cx);
workspace.add_panel(channels_panel, cx);
workspace.add_panel(chat_panel, cx);
workspace.add_panel(notification_panel, cx);
if !was_deserialized
&& workspace
@ -2432,6 +2451,7 @@ mod tests {
audio::init((), cx);
channel::init(&app_state.client, app_state.user_store.clone(), cx);
call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
notifications::init(app_state.client.clone(), app_state.user_store.clone(), cx);
workspace::init(app_state.clone(), cx);
Project::init_settings(cx);
language::init(cx);