Compare commits

...

8 Commits

Author SHA1 Message Date
Peter Tripp
b69573a366 Add conflicts-macos.json and conflicts-linux.json. 2024-08-22 15:25:06 -04:00
张小白
c0ea806afe windows: Treat pwsh as PowerShell (#16409)
`pwsh` is the newer version of `PowerShell`, while the one that comes
pre-installed on Windows is called `Windows PowerShell` and is an older
version. I have no idea why Microsoft dose this and not updated the
`Windows Powershell` on Windows.

Release Notes:

- N/A
2024-08-22 13:05:00 -06:00
renovate[bot]
1404e328cf Update Rust crate tree-sitter-css to v0.21.1 (#16635)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tree-sitter-css](https://togithub.com/tree-sitter/tree-sitter-css) |
workspace.dependencies | patch | `0.21.0` -> `0.21.1` |

---

### Release Notes

<details>
<summary>tree-sitter/tree-sitter-css (tree-sitter-css)</summary>

###
[`v0.21.1`](https://togithub.com/tree-sitter/tree-sitter-css/compare/v0.21.0...v0.21.1)

[Compare
Source](https://togithub.com/tree-sitter/tree-sitter-css/compare/v0.21.0...v0.21.1)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-22 13:02:23 -06:00
renovate[bot]
8ea8e81c86 Update Rust crate tree-sitter-html to v0.20.4 (#16642)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tree-sitter-html](https://togithub.com/tree-sitter/tree-sitter-html)
| workspace.dependencies | patch | `0.20.3` -> `0.20.4` |

---

### Release Notes

<details>
<summary>tree-sitter/tree-sitter-html (tree-sitter-html)</summary>

###
[`v0.20.4`](https://togithub.com/tree-sitter/tree-sitter-html/compare/v0.20.3...v0.20.4)

[Compare
Source](https://togithub.com/tree-sitter/tree-sitter-html/compare/v0.20.3...v0.20.4)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-22 13:02:04 -06:00
Cherry
e1c42a5c85 fs: Fix atomic_write failing on windows if destination is in different drive than the temp dir (#16648)
I have my system temp dir on a different drive than the default, so this
error was spammed in the logs. This also broke Zed in many ways, one of
which was the AI system failing to work since it couldn't save settings.
```
2024-08-20T22:39:54.0660708-07:00 [ERROR] Failed to write settings to file "\\\\?\\C:\\Users\\myuser\\AppData\\Roaming\\Zed\\settings.json"
Caused by:

0: failed to persist temporary file: The system cannot move the file to a different disk drive. (os error 17)

1: The system cannot move the file to a different disk drive. (os error 17)
```

Note: This problem is probably present on MacOS due to the requirement
of the underlying api being used. I do not have Mac, so I cannot test
this. This PR only solves this issue on Windows.

Closes #16571

Release Notes:

- fix atomic_write failing on windows if destination is on a different
drive than the OS's temp dir.
2024-08-22 12:59:00 -06:00
bestgopher
e17a5c1412 Fix log timestamps not using local timezone (#16400)
Get time offset by time crate will fail if there are mutli threads. So
call `config_builder.set_time_offset_to_local()` is useless.

Closes #16397

after:
<img width="664" alt="image"
src="https://github.com/user-attachments/assets/2b15fa06-c411-44f9-9ea1-871d25eb577f">

Release Notes:

- Fixed Local Timezone not showing Zed.log
2024-08-22 12:56:49 -06:00
张小白
20f85b946d windows: Don't panic if terminal creation fails (#16370)
Related #16352 

This PR picks up the upstream change
https://github.com/alacritty/alacritty/pull/8132, now when the terminal
creation fails, it will return an `Err` instead of directly panicing.

Release Notes:

- N/A
2024-08-22 12:55:16 -06:00
0x2CA
abb5800d20 Add bounded soft wrap (#16586)
Closes #14700 #8164

Release Notes:

- Added `soft_wrap` value `bounded`,EditorWidth and PreferredLineLength
min value

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-08-22 12:51:32 -06:00
12 changed files with 104 additions and 12 deletions

11
Cargo.lock generated
View File

@@ -83,7 +83,7 @@ dependencies = [
[[package]]
name = "alacritty_terminal"
version = "0.24.1-dev"
source = "git+https://github.com/alacritty/alacritty?rev=cacdb5bb3b72bad2c729227537979d95af75978f#cacdb5bb3b72bad2c729227537979d95af75978f"
source = "git+https://github.com/alacritty/alacritty?rev=91d034ff8b53867143c005acfaa14609147c9a2c#91d034ff8b53867143c005acfaa14609147c9a2c"
dependencies = [
"base64 0.22.1",
"bitflags 2.6.0",
@@ -11657,9 +11657,9 @@ dependencies = [
[[package]]
name = "tree-sitter-css"
version = "0.21.0"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2f806f96136762b0121f5fdd7172a3dcd8f42d37a2f23ed7f11b35895e20eb4"
checksum = "5e08e324b1cf60fd3291774b49724c66de2ce8fcf4d358d0b4b82e37b41b1c9b"
dependencies = [
"cc",
"tree-sitter",
@@ -11724,9 +11724,9 @@ dependencies = [
[[package]]
name = "tree-sitter-html"
version = "0.20.3"
version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3492b08a786bf5cc79feb0ef2ff3b115d5174364e0ddfd7860e0b9b088b53"
checksum = "8766b5ad3721517f8259e6394aefda9c686aebf7a8c74ab8624f2c3b46902fd5"
dependencies = [
"cc",
"tree-sitter",
@@ -13913,6 +13913,7 @@ dependencies = [
"terminal_view",
"theme",
"theme_selector",
"time",
"tree-sitter-md",
"tree-sitter-rust",
"ui",

View File

@@ -305,7 +305,7 @@ zed_actions = { path = "crates/zed_actions" }
#
aho-corasick = "1.1"
alacritty_terminal = { git = "https://github.com/alacritty/alacritty", rev = "cacdb5bb3b72bad2c729227537979d95af75978f" }
alacritty_terminal = { git = "https://github.com/alacritty/alacritty", rev = "91d034ff8b53867143c005acfaa14609147c9a2c" }
any_vec = "0.14"
anyhow = "1.0.86"
ashpd = "0.9.1"
@@ -388,7 +388,7 @@ runtimelib = { version = "0.15", default-features = false, features = [
rusqlite = { version = "0.29.0", features = ["blob", "array", "modern_sqlite"] }
rustc-demangle = "0.1.23"
rust-embed = { version = "8.4", features = ["include-exclude"] }
schemars = {version = "0.8", features = ["impl_json_schema"]}
schemars = { version = "0.8", features = ["impl_json_schema"] }
semver = "1.0"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_derive = { version = "1.0", features = ["deserialize_in_place"] }

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,59 @@
{
// https://github.com/zed-industries/zed/issues/16343
// See: https://support.apple.com/en-us/102650
"ctrl-up": "Mission Control",
"ctrl-down": "Application windows",
"ctrl-left": "Move left a space",
"ctrl-right": "Move right a space",
"f11": "Show Desktop",
"f14": "Decrease brightness",
"f15": "Increase brightness",
"ctrl-f14": "Decrease brightness (external display)",
"ctrl-f15": "Increase brightness (external display)",
"alt-f14": "Open Displays preferences",
"alt-f15": "Open Displays preferences",
"cmd-shift-q": "Logout (with confirmation)",
"cmd-alt-shift-q": "Logout (without confirmation)",
"cmd-ctrl-q": "Lock Screen",
"cmd-space": "Spotlight",
"cmd-alt-space": "Show Finder search Window",
"cmd-alt-d": "Turn Dock hiding on/off",
"cmd-alt-escape": "Force Quit",
"cmd-h": "Hide the windows of the front app",
"cmd-alt-h": "Hide the windows of all other apps",
"cmd-m": "Minimize the front window to the Dock.",
"cmd-tab": "Switch apps",
"cmd-shift-tab": "Switch apps in reverse",
"cmd-`": "Activate the next open window in the front app.",
"cmd-<": "Activate the next open window in the front app. (Swedish, etc)",
"cmd->": "Activate the previous open window in the front app. (Swedish, etc)",
"cmd-shift-`": "Activate the previous open window in the front app.",
"cmd-alt-f5": "Show Accessibility controls",
"cmd-f5": "Turn VoiceOver on or off",
"ctrl-f1": "Turn keyboard access on or off",
"ctrl-f2": "Move focus to the menu bar",
"ctrl-f3": "Move focus to the Dock.",
"ctrl-f4": "Move focus to the active or next window.",
"ctrl-f5": "Move focus to the window toolbar.",
"ctrl-f6": "Move focus to the floating window.",
"ctrl-f7": "Change the way Tab moves focus",
"ctrl-f8": "Move focus to the status menu in the menu bar",
"ctrl-shift-f4": "Move focus to the previous window.",
"ctrl-shift-f5": "Move focus to the window toolbar.",
"ctrl-shift-f6": "Move focus to the previous panel.",
// Screenshots
"cmd-shift-3": "Save picture of screen as file",
"cmd-shift-4": "Save picture of selected area as file",
"cmd-shift-5": "Screenshot and recording options",
"cmd-shift-ctrl-3": "Copy picture of screen to the clipboard",
"cmd-shift-ctrl-4": "Copy picture of selected area to the clipboard",
// Input
"ctrl-space": "Select the previous input source",
"ctrl-shift-space": "Select the next source in Input menu",
"ctrl-cmd-space": "Show the Character Viewer (emojis)",
// Others
"ctrl-alt-cmd-8": "invert colors (disabled by default)",
"ctrl-alt-cmd-,": "decrease contrast (disabled by default)",
"ctrl-alt-cmd-.": "increase contrast (disabled by default)",
"cmd-alt-`": "Move focus to the window drawer. (deprecated)"
}

View File

@@ -510,6 +510,8 @@
// "soft_wrap": "editor_width",
// 4. Soft wrap lines at the preferred line length.
// "soft_wrap": "preferred_line_length",
// 5. Soft wrap lines at the preferred line length or the editor width (whichever is smaller).
// "soft_wrap": "bounded",
"soft_wrap": "prefer_line",
// The column at which to soft-wrap lines, for buffers where soft-wrap
// is enabled.

View File

@@ -375,6 +375,7 @@ pub enum SoftWrap {
PreferLine,
EditorWidth,
Column(u32),
Bounded(u32),
}
#[derive(Clone)]
@@ -10491,6 +10492,8 @@ impl Editor {
if settings.show_wrap_guides {
if let SoftWrap::Column(soft_wrap) = self.soft_wrap_mode(cx) {
wrap_guides.push((soft_wrap as usize, true));
} else if let SoftWrap::Bounded(soft_wrap) = self.soft_wrap_mode(cx) {
wrap_guides.push((soft_wrap as usize, true));
}
wrap_guides.extend(settings.wrap_guides.iter().map(|guide| (*guide, false)))
}
@@ -10510,6 +10513,9 @@ impl Editor {
language_settings::SoftWrap::PreferredLineLength => {
SoftWrap::Column(settings.preferred_line_length)
}
language_settings::SoftWrap::Bounded => {
SoftWrap::Bounded(settings.preferred_line_length)
}
}
}
@@ -10551,7 +10557,7 @@ impl Editor {
} else {
let soft_wrap = match self.soft_wrap_mode(cx) {
SoftWrap::None | SoftWrap::PreferLine => language_settings::SoftWrap::EditorWidth,
SoftWrap::EditorWidth | SoftWrap::Column(_) => {
SoftWrap::EditorWidth | SoftWrap::Column(_) | SoftWrap::Bounded(_) => {
language_settings::SoftWrap::PreferLine
}
};

View File

@@ -4996,7 +4996,8 @@ impl Element for EditorElement {
Some((MAX_LINE_LEN / 2) as f32 * em_advance)
}
SoftWrap::EditorWidth => Some(editor_width),
SoftWrap::Column(column) => {
SoftWrap::Column(column) => Some(column as f32 * em_advance),
SoftWrap::Bounded(column) => {
Some(editor_width.min(column as f32 * em_advance))
}
};

View File

@@ -351,6 +351,16 @@ impl Fs for RealFs {
// invalid cross-device link error, and XDG_CACHE_DIR for fallback.
// See https://github.com/zed-industries/zed/pull/8437 for more details.
NamedTempFile::new_in(path.parent().unwrap_or(&paths::temp_dir()))
} else if cfg!(target_os = "windows") {
// If temp dir is set to a different drive than the destination,
// we receive error:
//
// failed to persist temporary file:
// The system cannot move the file to a different disk drive. (os error 17)
//
// So we use the directory of the destination as a temp dir to avoid it.
// https://github.com/zed-industries/zed/issues/16571
NamedTempFile::new_in(path.parent().unwrap_or(&paths::temp_dir()))
} else {
NamedTempFile::new()
}?;

View File

@@ -379,10 +379,12 @@ pub enum SoftWrap {
None,
/// Prefer a single line generally, unless an overly long line is encountered.
PreferLine,
/// Soft wrap lines that overflow the editor
/// Soft wrap lines that exceed the editor width
EditorWidth,
/// Soft wrap lines at the preferred line length
PreferredLineLength,
/// Soft wrap line at the preferred line length or the editor width (whichever is smaller)
Bounded,
}
/// Controls the behavior of formatting files when they are saved.

View File

@@ -886,7 +886,11 @@ fn to_windows_shell_variable(shell_type: WindowsShellType, input: String) -> Str
#[cfg(target_os = "windows")]
fn to_windows_shell_type(shell: &str) -> WindowsShellType {
if shell == "powershell" || shell.ends_with("powershell.exe") {
if shell == "powershell"
|| shell.ends_with("powershell.exe")
|| shell == "pwsh"
|| shell.ends_with("pwsh.exe")
{
WindowsShellType::Powershell
} else if shell == "cmd" || shell.ends_with("cmd.exe") {
WindowsShellType::Cmd

View File

@@ -97,6 +97,7 @@ tab_switcher.workspace = true
supermaven.workspace = true
task.workspace = true
tasks_ui.workspace = true
time.workspace = true
telemetry_events.workspace = true
terminal_view.workspace = true
theme.workspace = true

View File

@@ -8,6 +8,7 @@ mod zed;
use anyhow::{anyhow, Context as _, Result};
use assistant::PromptBuilder;
use chrono::Offset;
use clap::{command, Parser};
use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
use client::{parse_zed_link, Client, DevServerToken, UserStore};
@@ -44,6 +45,7 @@ use std::{
sync::Arc,
};
use theme::{ActiveTheme, SystemAppearance, ThemeRegistry, ThemeSettings};
use time::UtcOffset;
use util::{maybe, parse_env_output, ResultExt, TryFutureExt};
use uuid::Uuid;
use welcome::{show_welcome_view, BaseKeymap, FIRST_OPEN};
@@ -886,7 +888,10 @@ fn init_logger() {
let mut config_builder = ConfigBuilder::new();
config_builder.set_time_format_rfc3339();
config_builder.set_time_offset_to_local().log_err();
let local_offset = chrono::Local::now().offset().fix().local_minus_utc();
if let Ok(offset) = UtcOffset::from_whole_seconds(local_offset) {
config_builder.set_time_offset(offset);
}
#[cfg(target_os = "linux")]
{