Compare commits

...
Sign in to create a new pull request.

12 commits

Author SHA1 Message Date
Conrad Irwin
81509d8038 v0.109.3 2023-10-27 09:07:12 +02:00
Conrad Irwin
07f2bde034 Merge branch 'more-signing' 2023-10-27 09:01:39 +02:00
Joseph T. Lyons
36307aa2ce zed 0.109.2 2023-10-26 11:53:42 +02:00
Piotr Osiewicz
6796c1aaa0 vue: use anyhow::ensure instead of asserting on filesystem state (#3173)
Release Notes:
- Fixed a crash on failed assertion in Vue.js language support.
2023-10-26 11:49:09 +02:00
Max Brunsfeld
56634687a5 Name embedded.provisionprofile the same on stable as other channels 2023-10-25 18:02:50 +02:00
Max Brunsfeld
fd910b463d Avoid unused import in release builds 2023-10-25 17:19:47 +02:00
Joseph T. Lyons
289b001e03 v0.109.x stable 2023-10-25 16:07:12 +02:00
Kirill Bulatov
1e70dc2973 zed 0.109.1 2023-10-23 09:53:47 +02:00
Conrad Irwin
e202062152 Remove screen sharing indicator
This is now redundant given macOS has the same icon, and it panics when
you click on it :D.
2023-10-23 09:51:00 +02:00
Kirill Bulatov
ded60c675d Move prettier parsers data into languages from LSP adapters (#3150)
Release Notes:

- Fixed incorrect prettier parsers sometimes being applied to certain
files
2023-10-21 01:25:57 +02:00
Max Brunsfeld
c6466c1cce Fix possibility of infinite loop in selections_with_autoclose_regions (#3138)
Previously, that method could loop forever if the editor's autoclose
regions had unexpected selection ids.

Something must have changed recently that allowed this invariant to be
violated, but regardless, this code should not have relied on that
invariant to terminate like this.
2023-10-18 14:35:52 -04:00
Joseph T. Lyons
58dcb52336 v0.109.x preview 2023-10-18 12:30:57 -04:00
31 changed files with 104 additions and 233 deletions

2
Cargo.lock generated
View file

@ -10041,7 +10041,7 @@ dependencies = [
[[package]] [[package]]
name = "zed" name = "zed"
version = "0.109.0" version = "0.109.3"
dependencies = [ dependencies = [
"activity_indicator", "activity_indicator",
"ai", "ai",

View file

@ -15,8 +15,8 @@ use gpui::{executor::Deterministic, test::EmptyView, AppContext, ModelHandle, Te
use indoc::indoc; use indoc::indoc;
use language::{ use language::{
language_settings::{AllLanguageSettings, Formatter, InlayHintSettings}, language_settings::{AllLanguageSettings, Formatter, InlayHintSettings},
tree_sitter_rust, Anchor, BundledFormatter, Diagnostic, DiagnosticEntry, FakeLspAdapter, tree_sitter_rust, Anchor, Diagnostic, DiagnosticEntry, FakeLspAdapter, Language,
Language, LanguageConfig, LineEnding, OffsetRangeExt, Point, Rope, LanguageConfig, LineEnding, OffsetRangeExt, Point, Rope,
}; };
use live_kit_client::MacOSDisplay; use live_kit_client::MacOSDisplay;
use lsp::LanguageServerId; use lsp::LanguageServerId;
@ -4530,6 +4530,7 @@ async fn test_prettier_formatting_buffer(
LanguageConfig { LanguageConfig {
name: "Rust".into(), name: "Rust".into(),
path_suffixes: vec!["rs".to_string()], path_suffixes: vec!["rs".to_string()],
prettier_parser_name: Some("test_parser".to_string()),
..Default::default() ..Default::default()
}, },
Some(tree_sitter_rust::language()), Some(tree_sitter_rust::language()),
@ -4537,10 +4538,7 @@ async fn test_prettier_formatting_buffer(
let test_plugin = "test_plugin"; let test_plugin = "test_plugin";
let mut fake_language_servers = language let mut fake_language_servers = language
.set_fake_lsp_adapter(Arc::new(FakeLspAdapter { .set_fake_lsp_adapter(Arc::new(FakeLspAdapter {
enabled_formatters: vec![BundledFormatter::Prettier { prettier_plugins: vec![test_plugin],
parser_name: Some("test_parser"),
plugin_names: vec![test_plugin],
}],
..Default::default() ..Default::default()
})) }))
.await; .await;

View file

@ -8,7 +8,6 @@ mod incoming_call_notification;
mod notifications; mod notifications;
mod panel_settings; mod panel_settings;
pub mod project_shared_notification; pub mod project_shared_notification;
mod sharing_status_indicator;
use call::{report_call_event_for_room, ActiveCall, Room}; use call::{report_call_event_for_room, ActiveCall, Room};
use gpui::{ use gpui::{
@ -42,7 +41,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
chat_panel::init(cx); chat_panel::init(cx);
incoming_call_notification::init(&app_state, cx); incoming_call_notification::init(&app_state, cx);
project_shared_notification::init(&app_state, cx); project_shared_notification::init(&app_state, cx);
sharing_status_indicator::init(cx);
cx.add_global_action(toggle_screen_sharing); cx.add_global_action(toggle_screen_sharing);
cx.add_global_action(toggle_mute); cx.add_global_action(toggle_mute);

View file

@ -1,62 +0,0 @@
use crate::toggle_screen_sharing;
use call::ActiveCall;
use gpui::{
color::Color,
elements::{MouseEventHandler, Svg},
platform::{Appearance, MouseButton},
AnyElement, AppContext, Element, Entity, View, ViewContext,
};
use workspace::WorkspaceSettings;
pub fn init(cx: &mut AppContext) {
let active_call = ActiveCall::global(cx);
let mut status_indicator = None;
cx.observe(&active_call, move |call, cx| {
if let Some(room) = call.read(cx).room() {
if room.read(cx).is_screen_sharing() {
if status_indicator.is_none()
&& settings::get::<WorkspaceSettings>(cx).show_call_status_icon
{
status_indicator = Some(cx.add_status_bar_item(|_| SharingStatusIndicator));
}
} else if let Some(window) = status_indicator.take() {
window.update(cx, |cx| cx.remove_window());
}
} else if let Some(window) = status_indicator.take() {
window.update(cx, |cx| cx.remove_window());
}
})
.detach();
}
pub struct SharingStatusIndicator;
impl Entity for SharingStatusIndicator {
type Event = ();
}
impl View for SharingStatusIndicator {
fn ui_name() -> &'static str {
"SharingStatusIndicator"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
let color = match cx.window_appearance() {
Appearance::Light | Appearance::VibrantLight => Color::black(),
Appearance::Dark | Appearance::VibrantDark => Color::white(),
};
MouseEventHandler::new::<Self, _>(0, cx, |_, _| {
Svg::new("icons/desktop.svg")
.with_color(color)
.constrained()
.with_width(18.)
.aligned()
})
.on_click(MouseButton::Left, |_, _, cx| {
toggle_screen_sharing(&Default::default(), cx)
})
.into_any()
}
}

View file

@ -3286,8 +3286,10 @@ impl Editor {
i = 0; i = 0;
} else if pair_state.range.start.to_offset(buffer) > range.end { } else if pair_state.range.start.to_offset(buffer) > range.end {
break; break;
} else if pair_state.selection_id == selection.id { } else {
enclosing = Some(pair_state); if pair_state.selection_id == selection.id {
enclosing = Some(pair_state);
}
i += 1; i += 1;
} }
} }

View file

@ -19,8 +19,8 @@ use gpui::{
use indoc::indoc; use indoc::indoc;
use language::{ use language::{
language_settings::{AllLanguageSettings, AllLanguageSettingsContent, LanguageSettingsContent}, language_settings::{AllLanguageSettings, AllLanguageSettingsContent, LanguageSettingsContent},
BracketPairConfig, BundledFormatter, FakeLspAdapter, LanguageConfig, LanguageConfigOverride, BracketPairConfig, FakeLspAdapter, LanguageConfig, LanguageConfigOverride, LanguageRegistry,
LanguageRegistry, Override, Point, Override, Point,
}; };
use parking_lot::Mutex; use parking_lot::Mutex;
use project::project_settings::{LspSettings, ProjectSettings}; use project::project_settings::{LspSettings, ProjectSettings};
@ -5084,6 +5084,9 @@ async fn test_document_format_manual_trigger(cx: &mut gpui::TestAppContext) {
LanguageConfig { LanguageConfig {
name: "Rust".into(), name: "Rust".into(),
path_suffixes: vec!["rs".to_string()], path_suffixes: vec!["rs".to_string()],
// Enable Prettier formatting for the same buffer, and ensure
// LSP is called instead of Prettier.
prettier_parser_name: Some("test_parser".to_string()),
..Default::default() ..Default::default()
}, },
Some(tree_sitter_rust::language()), Some(tree_sitter_rust::language()),
@ -5094,12 +5097,6 @@ async fn test_document_format_manual_trigger(cx: &mut gpui::TestAppContext) {
document_formatting_provider: Some(lsp::OneOf::Left(true)), document_formatting_provider: Some(lsp::OneOf::Left(true)),
..Default::default() ..Default::default()
}, },
// Enable Prettier formatting for the same buffer, and ensure
// LSP is called instead of Prettier.
enabled_formatters: vec![BundledFormatter::Prettier {
parser_name: Some("test_parser"),
plugin_names: Vec::new(),
}],
..Default::default() ..Default::default()
})) }))
.await; .await;
@ -7838,6 +7835,7 @@ async fn test_document_format_with_prettier(cx: &mut gpui::TestAppContext) {
LanguageConfig { LanguageConfig {
name: "Rust".into(), name: "Rust".into(),
path_suffixes: vec!["rs".to_string()], path_suffixes: vec!["rs".to_string()],
prettier_parser_name: Some("test_parser".to_string()),
..Default::default() ..Default::default()
}, },
Some(tree_sitter_rust::language()), Some(tree_sitter_rust::language()),
@ -7846,10 +7844,7 @@ async fn test_document_format_with_prettier(cx: &mut gpui::TestAppContext) {
let test_plugin = "test_plugin"; let test_plugin = "test_plugin";
let _ = language let _ = language
.set_fake_lsp_adapter(Arc::new(FakeLspAdapter { .set_fake_lsp_adapter(Arc::new(FakeLspAdapter {
enabled_formatters: vec![BundledFormatter::Prettier { prettier_plugins: vec![test_plugin],
parser_name: Some("test_parser"),
plugin_names: vec![test_plugin],
}],
..Default::default() ..Default::default()
})) }))
.await; .await;

View file

@ -226,8 +226,8 @@ impl CachedLspAdapter {
self.adapter.label_for_symbol(name, kind, language).await self.adapter.label_for_symbol(name, kind, language).await
} }
pub fn enabled_formatters(&self) -> Vec<BundledFormatter> { pub fn prettier_plugins(&self) -> &[&'static str] {
self.adapter.enabled_formatters() self.adapter.prettier_plugins()
} }
} }
@ -336,31 +336,8 @@ pub trait LspAdapter: 'static + Send + Sync {
Default::default() Default::default()
} }
fn enabled_formatters(&self) -> Vec<BundledFormatter> { fn prettier_plugins(&self) -> &[&'static str] {
Vec::new() &[]
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum BundledFormatter {
Prettier {
// See https://prettier.io/docs/en/options.html#parser for a list of valid values.
// Usually, every language has a single parser (standard or plugin-provided), hence `Some("parser_name")` can be used.
// There can not be multiple parsers for a single language, in case of a conflict, we would attempt to select the one with most plugins.
//
// But exceptions like Tailwind CSS exist, which uses standard parsers for CSS/JS/HTML/etc. but require an extra plugin to be installed.
// For those cases, `None` will install the plugin but apply other, regular parser defined for the language, and this would not be a conflict.
parser_name: Option<&'static str>,
plugin_names: Vec<&'static str>,
},
}
impl BundledFormatter {
pub fn prettier(parser_name: &'static str) -> Self {
Self::Prettier {
parser_name: Some(parser_name),
plugin_names: Vec::new(),
}
} }
} }
@ -398,6 +375,8 @@ pub struct LanguageConfig {
pub overrides: HashMap<String, LanguageConfigOverride>, pub overrides: HashMap<String, LanguageConfigOverride>,
#[serde(default)] #[serde(default)]
pub word_characters: HashSet<char>, pub word_characters: HashSet<char>,
#[serde(default)]
pub prettier_parser_name: Option<String>,
} }
#[derive(Debug, Default)] #[derive(Debug, Default)]
@ -471,6 +450,7 @@ impl Default for LanguageConfig {
overrides: Default::default(), overrides: Default::default(),
collapsed_placeholder: Default::default(), collapsed_placeholder: Default::default(),
word_characters: Default::default(), word_characters: Default::default(),
prettier_parser_name: None,
} }
} }
} }
@ -496,7 +476,7 @@ pub struct FakeLspAdapter {
pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp::FakeLanguageServer)>>, pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp::FakeLanguageServer)>>,
pub disk_based_diagnostics_progress_token: Option<String>, pub disk_based_diagnostics_progress_token: Option<String>,
pub disk_based_diagnostics_sources: Vec<String>, pub disk_based_diagnostics_sources: Vec<String>,
pub enabled_formatters: Vec<BundledFormatter>, pub prettier_plugins: Vec<&'static str>,
} }
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
@ -1597,6 +1577,10 @@ impl Language {
override_id: None, override_id: None,
} }
} }
pub fn prettier_parser_name(&self) -> Option<&str> {
self.config.prettier_parser_name.as_deref()
}
} }
impl LanguageScope { impl LanguageScope {
@ -1759,7 +1743,7 @@ impl Default for FakeLspAdapter {
disk_based_diagnostics_progress_token: None, disk_based_diagnostics_progress_token: None,
initialization_options: None, initialization_options: None,
disk_based_diagnostics_sources: Vec::new(), disk_based_diagnostics_sources: Vec::new(),
enabled_formatters: Vec::new(), prettier_plugins: Vec::new(),
} }
} }
} }
@ -1817,8 +1801,8 @@ impl LspAdapter for Arc<FakeLspAdapter> {
self.initialization_options.clone() self.initialization_options.clone()
} }
fn enabled_formatters(&self) -> Vec<BundledFormatter> { fn prettier_plugins(&self) -> &[&'static str] {
self.enabled_formatters.clone() &self.prettier_plugins
} }
} }

View file

@ -3,11 +3,11 @@ use std::path::{Path, PathBuf};
use std::sync::Arc; use std::sync::Arc;
use anyhow::Context; use anyhow::Context;
use collections::{HashMap, HashSet}; use collections::HashMap;
use fs::Fs; use fs::Fs;
use gpui::{AsyncAppContext, ModelHandle}; use gpui::{AsyncAppContext, ModelHandle};
use language::language_settings::language_settings; use language::language_settings::language_settings;
use language::{Buffer, BundledFormatter, Diff}; use language::{Buffer, Diff};
use lsp::{LanguageServer, LanguageServerId}; use lsp::{LanguageServer, LanguageServerId};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -242,40 +242,16 @@ impl Prettier {
Self::Real(local) => { Self::Real(local) => {
let params = buffer.read_with(cx, |buffer, cx| { let params = buffer.read_with(cx, |buffer, cx| {
let buffer_language = buffer.language(); let buffer_language = buffer.language();
let parsers_with_plugins = buffer_language let parser_with_plugins = buffer_language.and_then(|l| {
.into_iter() let prettier_parser = l.prettier_parser_name()?;
.flat_map(|language| { let mut prettier_plugins = l
language .lsp_adapters()
.lsp_adapters() .iter()
.iter() .flat_map(|adapter| adapter.prettier_plugins())
.flat_map(|adapter| adapter.enabled_formatters()) .collect::<Vec<_>>();
.filter_map(|formatter| match formatter { prettier_plugins.dedup();
BundledFormatter::Prettier { Some((prettier_parser, prettier_plugins))
parser_name, });
plugin_names,
} => Some((parser_name, plugin_names)),
})
})
.fold(
HashMap::default(),
|mut parsers_with_plugins, (parser_name, plugins)| {
match parser_name {
Some(parser_name) => parsers_with_plugins
.entry(parser_name)
.or_insert_with(HashSet::default)
.extend(plugins),
None => parsers_with_plugins.values_mut().for_each(|existing_plugins| {
existing_plugins.extend(plugins.iter());
}),
}
parsers_with_plugins
},
);
let selected_parser_with_plugins = parsers_with_plugins.iter().max_by_key(|(_, plugins)| plugins.len());
if parsers_with_plugins.len() > 1 {
log::warn!("Found multiple parsers with plugins {parsers_with_plugins:?}, will select only one: {selected_parser_with_plugins:?}");
}
let prettier_node_modules = self.prettier_dir().join("node_modules"); let prettier_node_modules = self.prettier_dir().join("node_modules");
anyhow::ensure!(prettier_node_modules.is_dir(), "Prettier node_modules dir does not exist: {prettier_node_modules:?}"); anyhow::ensure!(prettier_node_modules.is_dir(), "Prettier node_modules dir does not exist: {prettier_node_modules:?}");
@ -296,7 +272,7 @@ impl Prettier {
} }
None None
}; };
let (parser, located_plugins) = match selected_parser_with_plugins { let (parser, located_plugins) = match parser_with_plugins {
Some((parser, plugins)) => { Some((parser, plugins)) => {
// Tailwind plugin requires being added last // Tailwind plugin requires being added last
// https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins // https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins

View file

@ -39,11 +39,11 @@ use language::{
deserialize_anchor, deserialize_fingerprint, deserialize_line_ending, deserialize_version, deserialize_anchor, deserialize_fingerprint, deserialize_line_ending, deserialize_version,
serialize_anchor, serialize_version, split_operations, serialize_anchor, serialize_version, split_operations,
}, },
range_from_lsp, range_to_lsp, Bias, Buffer, BufferSnapshot, BundledFormatter, CachedLspAdapter, range_from_lsp, range_to_lsp, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CodeAction,
CodeAction, CodeLabel, Completion, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, CodeLabel, Completion, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, Event as BufferEvent,
Event as BufferEvent, File as _, Language, LanguageRegistry, LanguageServerName, LocalFile, File as _, Language, LanguageRegistry, LanguageServerName, LocalFile, LspAdapterDelegate,
LspAdapterDelegate, OffsetRangeExt, Operation, Patch, PendingLanguageServer, PointUtf16, OffsetRangeExt, Operation, Patch, PendingLanguageServer, PointUtf16, TextBufferSnapshot,
TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped, ToOffset, ToPointUtf16, Transaction, Unclipped,
}; };
use log::error; use log::error;
use lsp::{ use lsp::{
@ -8352,12 +8352,7 @@ impl Project {
let Some(buffer_language) = buffer.language() else { let Some(buffer_language) = buffer.language() else {
return Task::ready(None); return Task::ready(None);
}; };
if !buffer_language if buffer_language.prettier_parser_name().is_none() {
.lsp_adapters()
.iter()
.flat_map(|adapter| adapter.enabled_formatters())
.any(|formatter| matches!(formatter, BundledFormatter::Prettier { .. }))
{
return Task::ready(None); return Task::ready(None);
} }
@ -8510,16 +8505,15 @@ impl Project {
}; };
let mut prettier_plugins = None; let mut prettier_plugins = None;
for formatter in new_language if new_language.prettier_parser_name().is_some() {
.lsp_adapters() prettier_plugins
.into_iter() .get_or_insert_with(|| HashSet::default())
.flat_map(|adapter| adapter.enabled_formatters()) .extend(
{ new_language
match formatter { .lsp_adapters()
BundledFormatter::Prettier { plugin_names, .. } => prettier_plugins .iter()
.get_or_insert_with(|| HashSet::default()) .flat_map(|adapter| adapter.prettier_plugins()),
.extend(plugin_names), )
}
} }
let Some(prettier_plugins) = prettier_plugins else { let Some(prettier_plugins) = prettier_plugins else {
return Task::ready(Ok(())); return Task::ready(Ok(()));

View file

@ -3,7 +3,7 @@ authors = ["Nathan Sobo <nathansobo@gmail.com>"]
description = "The fast, collaborative code editor." description = "The fast, collaborative code editor."
edition = "2021" edition = "2021"
name = "zed" name = "zed"
version = "0.109.0" version = "0.109.3"
publish = false publish = false
[lib] [lib]

View file

@ -1 +1 @@
dev stable

View file

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>com.apple.developer.associated-domains</key>
<array><string>applinks:zed.dev</string></array>
<key>com.apple.security.automation.apple-events</key> <key>com.apple.security.automation.apple-events</key>
<true/> <true/>
<key>com.apple.security.cs.allow-jit</key> <key>com.apple.security.cs.allow-jit</key>
@ -12,8 +10,14 @@
<true/> <true/>
<key>com.apple.security.device.camera</key> <key>com.apple.security.device.camera</key>
<true/> <true/>
<key>com.apple.security.keychain-access-groups</key> <key>com.apple.security.personal-information.addressbook</key>
<array><string>MQ55VZLNZQ.dev.zed.Shared</string></array> <true/>
<key>com.apple.security.personal-information.calendars</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>com.apple.security.personal-information.photos-library</key>
<true/>
<!-- <key>com.apple.security.cs.disable-library-validation</key> <!-- <key>com.apple.security.cs.disable-library-validation</key>
<true/> --> <true/> -->
</dict> </dict>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,3 +7,4 @@ brackets = [
{ 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"] },
] ]
prettier_parser_name = "json"

View file

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

View file

@ -12,6 +12,7 @@ brackets = [
{ start = "`", end = "`", close = true, newline = false, not_in = ["string"] }, { start = "`", end = "`", close = true, newline = false, not_in = ["string"] },
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] }, { start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
] ]
prettier_parser_name = "svelte"
[overrides.element] [overrides.element]
line_comment = { remove = true } line_comment = { remove = true }

View file

@ -6,7 +6,7 @@ use futures::{
FutureExt, StreamExt, FutureExt, StreamExt,
}; };
use gpui::AppContext; use gpui::AppContext;
use language::{BundledFormatter, LanguageServerName, LspAdapter, LspAdapterDelegate}; use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp::LanguageServerBinary; use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use serde_json::{json, Value}; use serde_json::{json, Value};
@ -128,11 +128,8 @@ impl LspAdapter for TailwindLspAdapter {
) )
} }
fn enabled_formatters(&self) -> Vec<BundledFormatter> { fn prettier_plugins(&self) -> &[&'static str] {
vec![BundledFormatter::Prettier { &["prettier-plugin-tailwindcss"]
parser_name: None,
plugin_names: vec!["prettier-plugin-tailwindcss"],
}]
} }
} }

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, ensure, Result};
use async_trait::async_trait; use async_trait::async_trait;
use futures::StreamExt; use futures::StreamExt;
pub use language::*; pub use language::*;
@ -98,7 +98,10 @@ impl super::LspAdapter for VueLspAdapter {
) )
.await?; .await?;
} }
assert!(fs::metadata(&server_path).await.is_ok()); ensure!(
fs::metadata(&server_path).await.is_ok(),
"@vue/language-server package installation failed"
);
if fs::metadata(&ts_path).await.is_err() { if fs::metadata(&ts_path).await.is_err() {
self.node self.node
.npm_install_packages( .npm_install_packages(
@ -108,7 +111,10 @@ impl super::LspAdapter for VueLspAdapter {
.await?; .await?;
} }
assert!(fs::metadata(&ts_path).await.is_ok()); ensure!(
fs::metadata(&ts_path).await.is_ok(),
"typescript for Vue package installation failed"
);
*self.typescript_install_path.lock() = Some(ts_path); *self.typescript_install_path.lock() = Some(ts_path);
Ok(LanguageServerBinary { Ok(LanguageServerBinary {
path: self.node.binary_path().await?, path: self.node.binary_path().await?,

View file

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

View file

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

View file

@ -33,7 +33,7 @@ use std::{
Arc, Weak, Arc, Weak,
}, },
thread, thread,
time::{Duration, SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
}; };
use util::{ use util::{
channel::{parse_zed_link, ReleaseChannel}, channel::{parse_zed_link, ReleaseChannel},
@ -656,7 +656,7 @@ fn load_embedded_fonts(app: &App) {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
async fn watch_themes(fs: Arc<dyn Fs>, mut cx: AsyncAppContext) -> Option<()> { async fn watch_themes(fs: Arc<dyn Fs>, mut cx: AsyncAppContext) -> Option<()> {
let mut events = fs let mut events = fs
.watch("styles/src".as_ref(), Duration::from_millis(100)) .watch("styles/src".as_ref(), std::time::Duration::from_millis(100))
.await; .await;
while (events.next().await).is_some() { while (events.next().await).is_some() {
let output = Command::new("npm") let output = Command::new("npm")
@ -682,7 +682,7 @@ async fn watch_languages(fs: Arc<dyn Fs>, languages: Arc<LanguageRegistry>) -> O
let mut events = fs let mut events = fs
.watch( .watch(
"crates/zed/src/languages".as_ref(), "crates/zed/src/languages".as_ref(),
Duration::from_millis(100), std::time::Duration::from_millis(100),
) )
.await; .await;
while (events.next().await).is_some() { while (events.next().await).is_some() {
@ -697,7 +697,7 @@ fn watch_file_types(fs: Arc<dyn Fs>, cx: &mut AppContext) {
let mut events = fs let mut events = fs
.watch( .watch(
"assets/icons/file_icons/file_types.json".as_ref(), "assets/icons/file_icons/file_types.json".as_ref(),
Duration::from_millis(100), std::time::Duration::from_millis(100),
) )
.await; .await;
while (events.next().await).is_some() { while (events.next().await).is_some() {

View file

@ -147,8 +147,9 @@ if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTAR
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CERTIFICATE_PASSWORD" zed.keychain security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CERTIFICATE_PASSWORD" zed.keychain
# sequence of codesign commands modeled after this example: https://developer.apple.com/forums/thread/701514 # sequence of codesign commands modeled after this example: https://developer.apple.com/forums/thread/701514
/usr/bin/codesign --force --timestamp --sign "Zed Industries, Inc." "${app_path}/Contents/Frameworks/WebRTC.framework" -v /usr/bin/codesign --deep --force --timestamp --sign "Zed Industries, Inc." "${app_path}/Contents/Frameworks/WebRTC.framework" -v
/usr/bin/codesign --force --timestamp --options runtime --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/cli" -v /usr/bin/codesign --deep --force --timestamp --options runtime --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/cli" -v
/usr/bin/codesign --deep --force --timestamp --options runtime --entitlements crates/zed/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/zed" -v
/usr/bin/codesign --force --timestamp --options runtime --entitlements crates/zed/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}" -v /usr/bin/codesign --force --timestamp --options runtime --entitlements crates/zed/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}" -v
security default-keychain -s login.keychain security default-keychain -s login.keychain