Compare commits
9 Commits
lua-run-cl
...
v0.129.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6866187d1e | ||
|
|
0784e1c72f | ||
|
|
9641ae0755 | ||
|
|
ce73ff9808 | ||
|
|
240db73199 | ||
|
|
6b52917e75 | ||
|
|
f226a9932a | ||
|
|
a7915cb848 | ||
|
|
2d8288f076 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -12457,7 +12457,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zed"
|
||||
version = "0.129.0"
|
||||
version = "0.129.2"
|
||||
dependencies = [
|
||||
"activity_indicator",
|
||||
"anyhow",
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
[Interface]
|
||||
PrivateKey = B5Fp/yVfP0QYlb+YJv9ea+EMI1mWODPD3akh91cVjvc=
|
||||
Address = fdaa:0:2ce3:a7b:bea:0:a:2/120
|
||||
DNS = fdaa:0:2ce3::3
|
||||
|
||||
[Peer]
|
||||
PublicKey = RKAYPljEJiuaELNDdQIEJmQienT9+LRISfIHwH45HAw=
|
||||
AllowedIPs = fdaa:0:2ce3::/48
|
||||
Endpoint = ord1.gateway.6pn.dev:51820
|
||||
PersistentKeepalive = 15
|
||||
|
||||
@@ -764,6 +764,7 @@ mod tests {
|
||||
multibuffer
|
||||
});
|
||||
let editor = cx.add_window(|cx| Editor::for_multibuffer(multibuffer, None, cx));
|
||||
editor.update(cx, |editor, cx| editor.focus(cx)).unwrap();
|
||||
let copilot_provider = cx.new_model(|_| CopilotCompletionProvider::new(copilot));
|
||||
editor
|
||||
.update(cx, |editor, cx| {
|
||||
|
||||
@@ -1676,7 +1676,9 @@ impl Editor {
|
||||
) {
|
||||
self.inline_completion_provider = Some(RegisteredInlineCompletionProvider {
|
||||
_subscription: cx.observe(&provider, |this, _, cx| {
|
||||
this.update_visible_inline_completion(cx);
|
||||
if this.focus_handle.is_focused(cx) {
|
||||
this.update_visible_inline_completion(cx);
|
||||
}
|
||||
}),
|
||||
provider: Arc::new(provider),
|
||||
});
|
||||
|
||||
@@ -761,7 +761,7 @@ impl ExtensionStore {
|
||||
|
||||
if let Some(telemetry) = &self.telemetry {
|
||||
for extension_id in &extensions_to_load {
|
||||
if let Some(extension) = self.extension_index.extensions.get(extension_id) {
|
||||
if let Some(extension) = new_index.extensions.get(extension_id) {
|
||||
telemetry.report_extension_event(
|
||||
extension_id.clone(),
|
||||
extension.manifest.version.clone(),
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use collections::HashSet;
|
||||
use fs::Fs;
|
||||
use futures::{
|
||||
@@ -44,51 +44,48 @@ pub(super) async fn format_with_prettier(
|
||||
project: &WeakModel<Project>,
|
||||
buffer: &Model<Buffer>,
|
||||
cx: &mut AsyncAppContext,
|
||||
) -> Option<FormatOperation> {
|
||||
if let Some((prettier_path, prettier_task)) = project
|
||||
) -> Option<Result<FormatOperation>> {
|
||||
let prettier_instance = project
|
||||
.update(cx, |project, cx| {
|
||||
project.prettier_instance_for_buffer(buffer, cx)
|
||||
})
|
||||
.ok()?
|
||||
.await
|
||||
{
|
||||
match prettier_task.await {
|
||||
Ok(prettier) => {
|
||||
let buffer_path = buffer
|
||||
.update(cx, |buffer, cx| {
|
||||
File::from_dyn(buffer.file()).map(|file| file.abs_path(cx))
|
||||
})
|
||||
.ok()?;
|
||||
match prettier.format(buffer, buffer_path, cx).await {
|
||||
Ok(new_diff) => return Some(FormatOperation::Prettier(new_diff)),
|
||||
Err(e) => {
|
||||
match prettier_path {
|
||||
Some(prettier_path) => log::error!(
|
||||
"Prettier instance from path {prettier_path:?} failed to format a buffer: {e:#}"
|
||||
),
|
||||
None => log::error!(
|
||||
"Default prettier instance failed to format a buffer: {e:#}"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => project
|
||||
.await;
|
||||
|
||||
let Some((prettier_path, prettier_task)) = prettier_instance else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let prettier_description = match prettier_path.as_ref() {
|
||||
Some(path) => format!("prettier at {path:?}"),
|
||||
None => "default prettier instance".to_string(),
|
||||
};
|
||||
|
||||
match prettier_task.await {
|
||||
Ok(prettier) => {
|
||||
let buffer_path = buffer
|
||||
.update(cx, |buffer, cx| {
|
||||
File::from_dyn(buffer.file()).map(|file| file.abs_path(cx))
|
||||
})
|
||||
.ok()?;
|
||||
|
||||
let format_result = prettier
|
||||
.format(buffer, buffer_path, cx)
|
||||
.await
|
||||
.map(FormatOperation::Prettier)
|
||||
.with_context(|| format!("{} failed to format buffer", prettier_description));
|
||||
|
||||
Some(format_result)
|
||||
}
|
||||
Err(error) => {
|
||||
project
|
||||
.update(cx, |project, _| {
|
||||
let instance_to_update = match prettier_path {
|
||||
Some(prettier_path) => {
|
||||
log::error!(
|
||||
"Prettier instance from path {prettier_path:?} failed to spawn: {e:#}"
|
||||
);
|
||||
project.prettier_instances.get_mut(&prettier_path)
|
||||
}
|
||||
None => {
|
||||
log::error!("Default prettier instance failed to spawn: {e:#}");
|
||||
match &mut project.default_prettier.prettier {
|
||||
PrettierInstallation::NotInstalled { .. } => None,
|
||||
PrettierInstallation::Installed(instance) => Some(instance),
|
||||
}
|
||||
}
|
||||
Some(prettier_path) => project.prettier_instances.get_mut(&prettier_path),
|
||||
None => match &mut project.default_prettier.prettier {
|
||||
PrettierInstallation::NotInstalled { .. } => None,
|
||||
PrettierInstallation::Installed(instance) => Some(instance),
|
||||
},
|
||||
};
|
||||
|
||||
if let Some(instance) = instance_to_update {
|
||||
@@ -96,11 +93,14 @@ pub(super) async fn format_with_prettier(
|
||||
instance.prettier = None;
|
||||
}
|
||||
})
|
||||
.ok()?,
|
||||
.log_err();
|
||||
|
||||
Some(Err(anyhow!(
|
||||
"{} failed to spawn: {error:#}",
|
||||
prettier_description
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub struct DefaultPrettier {
|
||||
|
||||
@@ -4652,10 +4652,11 @@ impl Project {
|
||||
}
|
||||
}
|
||||
(Formatter::Auto, FormatOnSave::On | FormatOnSave::Off) => {
|
||||
if let Some(new_operation) =
|
||||
prettier_support::format_with_prettier(&project, buffer, &mut cx).await
|
||||
{
|
||||
format_operation = Some(new_operation);
|
||||
let prettier =
|
||||
prettier_support::format_with_prettier(&project, buffer, &mut cx).await;
|
||||
|
||||
if let Some(operation) = prettier {
|
||||
format_operation = Some(operation?);
|
||||
} else if let Some((language_server, buffer_abs_path)) = server_and_buffer {
|
||||
format_operation = Some(FormatOperation::Lsp(
|
||||
Self::format_via_lsp(
|
||||
@@ -4672,10 +4673,11 @@ impl Project {
|
||||
}
|
||||
}
|
||||
(Formatter::Prettier, FormatOnSave::On | FormatOnSave::Off) => {
|
||||
if let Some(new_operation) =
|
||||
prettier_support::format_with_prettier(&project, buffer, &mut cx).await
|
||||
{
|
||||
format_operation = Some(new_operation);
|
||||
let prettier =
|
||||
prettier_support::format_with_prettier(&project, buffer, &mut cx).await;
|
||||
|
||||
if let Some(operation) = prettier {
|
||||
format_operation = Some(operation?);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -296,15 +296,19 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_format_distance_from_now() {
|
||||
fn test_format_distance_from_hms() {
|
||||
let date = DateTimeType::Naive(
|
||||
NaiveDateTime::parse_from_str("1969-07-20T00:00:00Z", "%Y-%m-%dT%H:%M:%SZ")
|
||||
NaiveDateTime::parse_from_str("1969-07-20T11:22:33Z", "%Y-%m-%dT%H:%M:%SZ")
|
||||
.expect("Invalid NaiveDateTime for date"),
|
||||
);
|
||||
let base_date = DateTimeType::Naive(
|
||||
NaiveDateTime::parse_from_str("2024-02-01T00:00:00Z", "%Y-%m-%dT%H:%M:%SZ")
|
||||
.expect("Invalid NaiveDateTime for base_date"),
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
"over 54 years ago",
|
||||
format_distance_from_now(date, false, true, false)
|
||||
format_distance(date, base_date.to_naive(), false, true, false)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
description = "The fast, collaborative code editor."
|
||||
edition = "2021"
|
||||
name = "zed"
|
||||
version = "0.129.0"
|
||||
version = "0.129.2"
|
||||
publish = false
|
||||
license = "GPL-3.0-or-later"
|
||||
authors = ["Zed Team <hi@zed.dev>"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
dev
|
||||
stable
|
||||
Reference in New Issue
Block a user