Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
43823c2
Terminal path hyperlink regex settings
davewa Aug 29, 2025
b3c5dbd
Add LLVM-style line and column suffix regex
davewa Aug 30, 2025
c716de2
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Aug 31, 2025
a6c06ce
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Sep 4, 2025
4079a8d
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Sep 17, 2025
f129099
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 7, 2025
8054973
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 12, 2025
4099ad3
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 13, 2025
b7ed7da
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 15, 2025
a1ed1a8
Settings path_hyperlink_regexes works
davewa Oct 16, 2025
dab92b1
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 16, 2025
d89d2c1
Docs, timeout, error handling, logging
davewa Oct 16, 2025
782d4d1
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 16, 2025
dab832f
Add test specifically covering part 2 of #12338
davewa Oct 16, 2025
ff308a9
Improve log message
davewa Oct 16, 2025
4ac4d73
Even better log messages
davewa Oct 16, 2025
6ab6be1
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 17, 2025
5d19b04
Small cleanup
davewa Oct 17, 2025
2320358
Don't produce a hyperlink that is not under the cursor
davewa Oct 17, 2025
0df21a3
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 21, 2025
77849b4
Improve default.json documentation for path_hyperlink_regexes
davewa Oct 21, 2025
442870e
Handle multiple matches on the same line, and fix more wide char cases.
davewa Oct 21, 2025
c50661f
Improve rust diagnostic tests to handle 'panicked at', 'at' and optional
davewa Oct 21, 2025
b3d38c1
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 22, 2025
8738452
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 22, 2025
161b612
Move all path matches to regex, enable unicode punctuation and emoji
davewa Oct 24, 2025
43287a1
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 24, 2025
b2d6c8d
Improve documentation, simplify line:column:desc regexes.
davewa Oct 24, 2025
a1ad2f7
Merge code from #40146, add more benches
davewa Oct 24, 2025
99cc816
Add tests for MSBuild-style line column variations, fix default regex
davewa Oct 25, 2025
195a6e0
Fix benchmark regexes ordering
davewa Oct 25, 2025
254ed4a
Fix path_hyperlink_regexes doc comment
davewa Oct 25, 2025
27fa5bd
Consolidate default regexes
davewa Oct 25, 2025
1162f4c
Add bench-support feature
davewa Oct 25, 2025
40beefb
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 25, 2025
d1bd906
Use 500 lines for path hyperlinks benchmarks
davewa Oct 25, 2025
f17a185
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 27, 2025
eabee16
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 28, 2025
bbd084f
Upgrade to fancy-regex
davewa Oct 28, 2025
4877f96
Remove dead code
davewa Oct 28, 2025
1bc1982
Use fancy-regex for path hyperlinks
davewa Oct 30, 2025
c0de2d9
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 30, 2025
bce030a
Improve default path_hyperlink_regexes, hopefully fix Windows test
davewa Oct 30, 2025
602193f
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 30, 2025
064a985
Don't need (?xs), just (?x)
davewa Oct 30, 2025
d974206
Improve path_hyperlink_regexes documentation
davewa Oct 30, 2025
5a909dc
Rename Python regex
davewa Oct 31, 2025
d032d4b
Add code comment explaining why we don't use Term::bounds_to_string
davewa Oct 31, 2025
afcf38f
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 31, 2025
7e821d6
Improve documentation
davewa Oct 31, 2025
71c2008
Update test case name for #39189
davewa Oct 31, 2025
3af713e
Simplify regexes, fix trailing punctuation, add tests
davewa Oct 31, 2025
091b7da
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Oct 31, 2025
5c13d42
Simplify regex
davewa Oct 31, 2025
526381f
Eliminate one default regex, improve the remaining, adding Windows UNC
davewa Nov 1, 2025
bf7d6a5
Because of course that prefix has no effect...
davewa Nov 1, 2025
ef11767
And then there was one... first try!!!
davewa Nov 1, 2025
54fed77
Move bench into terminal_hyperlinks
davewa Nov 1, 2025
293a516
Cleanup closer return types
davewa Nov 1, 2025
0b16595
Tidy
davewa Nov 1, 2025
8076e49
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 1, 2025
e529038
Tweaks
davewa Nov 1, 2025
70d0d01
Looking into the future...
davewa Nov 2, 2025
c4dff4e
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 2, 2025
6b13f0b
Cleanup closures, simplify
davewa Nov 2, 2025
1bb9b5b
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 2, 2025
7505e36
Use regexes from default.json in tests
davewa Nov 3, 2025
84136ce
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 3, 2025
6188490
Add test coverage for custom regexes with line and column, improve
davewa Nov 3, 2025
5e6b433
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 4, 2025
5b4746a
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 5, 2025
65035eb
Simplify default path hyperlink regex
davewa Nov 5, 2025
0e47206
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 6, 2025
49f4fae
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 7, 2025
20dd3a9
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 8, 2025
1ee3c65
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 10, 2025
8ddbc51
Merge two log messages into one
davewa Nov 10, 2025
c148c5f
Small improvement of row and column processing
davewa Nov 10, 2025
26d8a13
Allow single string or array of strings for path_hyperlink_regexes in
davewa Nov 10, 2025
18d1e5d
Default timeout for path hyperlinking is now 1ms, disable hyperlinking
davewa Nov 10, 2025
f27d5cc
Move path_hyperlink_regexes into terminal project settings
davewa Nov 10, 2025
0660621
Add path_hyperlink_regexes to configuring-zed.md docs
davewa Nov 10, 2025
d276233
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 11, 2025
caf01d5
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 11, 2025
ddd8bbe
criterion -> #[perf]
davewa Nov 11, 2025
8b7cda1
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 11, 2025
b6fa4e0
Prettier (hopefully)
davewa Nov 11, 2025
8226f91
...and docs
davewa Nov 11, 2025
8d0c1e8
Simplify default.json comment
davewa Nov 11, 2025
7b82d08
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 12, 2025
1b0a9be
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 13, 2025
e0a9e02
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 17, 2025
8f8dc96
Add `link` capture group to preserve existing Python path hyperlink
davewa Nov 17, 2025
c1243b2
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 18, 2025
9cec35a
Use the entire match text unless `link` is specified
davewa Nov 18, 2025
718ec5a
Merge remote-tracking branch 'origin/main' into 12338-paths-with-spaces
davewa Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 53 additions & 1 deletion assets/settings/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,59 @@
//
// Most terminal themes have APCA values of 40-70.
// A value of 45 preserves colorful themes while ensuring legibility.
"minimum_contrast": 45
"minimum_contrast": 45,
// Regexes used to identify paths for hyperlink navigation. Supports optional named capture
// groups `path`, `line`, `column`, and `link`. If none of these are present, the entire match
// is the hyperlink target. If `path` is present, it is the hyperlink target, along with `line`
// and `column` if present. `link` may be used to customize what text in terminal is part of the
// hyperlink. If `link` is not present, the text of the entire match is used. If `line` and
// `column` are not present, the default built-in line and column suffix processing is used
// which parses `line:column` and `(line,column)` variants. The default value handles Python
// diagnostics and common path, line, column syntaxes. This can be extended or replaced to
// handle specific scenarios. For example, to enable support for hyperlinking paths which
// contain spaces in rust output,
//
// [
// "\\s+(-->|:::|at) (?<link>(?<path>.+?))(:$|$)",
// "\\s+(Compiling|Checking|Documenting) [^(]+\\((?<link>(?<path>.+))\\)"
// ],
//
// could be used. Processing stops at the first regex with a match, even if no link is
// produced which is the case when the cursor is not over the hyperlinked text. For best
// performance it is recommended to order regexes from most common to least common. For
// readability and documentation, each regex may be an array of strings which are collected
// into one multi-line regex string for use in terminal path hyperlink detection.
"path_hyperlink_regexes": [
// Python-style diagnostics
"File \"(?<path>[^\"]+)\", line (?<line>[0-9]+)",
// Common path syntax with optional line, column, description, trailing punctuation, or
// surrounding symbols or quotes
[
"(?x)",
"# optionally starts with 0-2 opening prefix symbols",
"[({\\[<]{0,2}",
"# which may be followed by an opening quote",
"(?<quote>[\"'`])?",
"# `path` is the shortest sequence of any non-space character",
"(?<link>(?<path>[^ ]+?",
" # which may end with a line and optionally a column,",
" (?<line_column>:+[0-9]+(:[0-9]+)?|:?\\([0-9]+([,:][0-9]+)?\\))?",
"))",
"# which must be followed by a matching quote",
"(?(<quote>)\\k<quote>)",
"# and optionally a single closing symbol",
"[)}\\]>]?",
"# if line/column matched, may be followed by a description",
"(?(<line_column>):[^ 0-9][^ ]*)?",
"# which may be followed by trailing punctuation",
"[.,:)}\\]>]*",
"# and always includes trailing whitespace or end of line",
"([ ]+|$)"
]
],
Comment thread
davewa marked this conversation as resolved.
// Timeout for hover and Cmd-click path hyperlink discovery in milliseconds. Specifying a
// timeout of `0` will disable path hyperlinking in terminal.
"path_hyperlink_timeout_ms": 1
},
"code_actions_on_format": {},
// Settings related to running tasks.
Expand Down
4 changes: 4 additions & 0 deletions crates/project/src/terminals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ impl Project {
settings.cursor_shape,
settings.alternate_scroll,
settings.max_scroll_history_lines,
settings.path_hyperlink_regexes,
settings.path_hyperlink_timeout_ms,
is_via_remote,
cx.entity_id().as_u64(),
Some(completion_tx),
Expand Down Expand Up @@ -369,6 +371,8 @@ impl Project {
settings.cursor_shape,
settings.alternate_scroll,
settings.max_scroll_history_lines,
settings.path_hyperlink_regexes,
settings.path_hyperlink_timeout_ms,
is_via_remote,
cx.entity_id().as_u64(),
None,
Expand Down
42 changes: 42 additions & 0 deletions crates/settings/src/settings_content/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,41 @@ pub struct ProjectTerminalSettingsContent {
///
/// Default: on
pub detect_venv: Option<VenvSettings>,
/// Regexes used to identify paths for hyperlink navigation.
///
/// Default: [
/// // Python-style diagnostics
/// "File \"(?<path>[^\"]+)\", line (?<line>[0-9]+)",
/// // Common path syntax with optional line, column, description, trailing punctuation, or
/// // surrounding symbols or quotes
/// [
/// "(?x)",
/// "# optionally starts with 0-2 opening prefix symbols",
/// "[({\\[<]{0,2}",
/// "# which may be followed by an opening quote",
/// "(?<quote>[\"'`])?",
/// "# `path` is the shortest sequence of any non-space character",
/// "(?<link>(?<path>[^ ]+?",
/// " # which may end with a line and optionally a column,",
/// " (?<line_column>:+[0-9]+(:[0-9]+)?|:?\\([0-9]+([,:][0-9]+)?\\))?",
/// "))",
/// "# which must be followed by a matching quote",
/// "(?(<quote>)\\k<quote>)",
/// "# and optionally a single closing symbol",
/// "[)}\\]>]?",
/// "# if line/column matched, may be followed by a description",
/// "(?(<line_column>):[^ 0-9][^ ]*)?",
/// "# which may be followed by trailing punctuation",
/// "[.,:)}\\]>]*",
/// "# and always includes trailing whitespace or end of line",
/// "([ ]+|$)"
/// ]
/// ]
pub path_hyperlink_regexes: Option<Vec<PathHyperlinkRegex>>,
/// Timeout for hover and Cmd-click path hyperlink discovery in milliseconds.
///
/// Default: 1
pub path_hyperlink_timeout_ms: Option<u64>,
}

#[skip_serializing_none]
Expand Down Expand Up @@ -413,6 +448,13 @@ impl VenvSettings {
}
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema, MergeFrom)]
#[serde(untagged)]
pub enum PathHyperlinkRegex {
SingleLine(String),
MultiLine(Vec<String>),
}

#[derive(
Copy,
Clone,
Expand Down
2 changes: 2 additions & 0 deletions crates/settings/src/vscode_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,8 @@ impl VsCodeSettings {
working_directory: None,
env,
detect_venv: None,
path_hyperlink_regexes: None,
path_hyperlink_timeout_ms: None,
}
}

Expand Down
7 changes: 5 additions & 2 deletions crates/terminal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ anyhow.workspace = true
collections.workspace = true
futures.workspace = true
gpui.workspace = true
itertools.workspace = true
libc.workspace = true
log.workspace = true
release_channel.workspace = true
Expand All @@ -37,14 +38,16 @@ task.workspace = true
theme.workspace = true
thiserror.workspace = true
util.workspace = true
regex.workspace = true
fancy-regex.workspace = true
urlencoding.workspace = true
itertools.workspace = true

[target.'cfg(windows)'.dependencies]
windows.workspace = true

[dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
rand.workspace = true
serde_json.workspace = true
settings = { workspace = true, features = ["test-support"] }
url.workspace = true
util_macros.workspace = true
23 changes: 21 additions & 2 deletions crates/terminal/src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl TerminalBuilder {
scroll_px: px(0.),
next_link_id: 0,
selection_phase: SelectionPhase::Ended,
hyperlink_regex_searches: RegexSearches::new(),
hyperlink_regex_searches: RegexSearches::default(),
vi_mode_enabled: false,
is_remote_terminal: false,
last_mouse_move_time: Instant::now(),
Expand All @@ -388,6 +388,8 @@ impl TerminalBuilder {
cursor_shape,
alternate_scroll,
max_scroll_history_lines,
path_hyperlink_regexes: Vec::default(),
path_hyperlink_timeout_ms: 0,
window_id,
},
child_exited: None,
Expand All @@ -408,6 +410,8 @@ impl TerminalBuilder {
cursor_shape: CursorShape,
alternate_scroll: AlternateScroll,
max_scroll_history_lines: Option<usize>,
path_hyperlink_regexes: Vec<String>,
path_hyperlink_timeout_ms: u64,
is_remote_terminal: bool,
window_id: u64,
completion_tx: Option<Sender<Option<ExitStatus>>>,
Expand Down Expand Up @@ -592,7 +596,10 @@ impl TerminalBuilder {
scroll_px: px(0.),
next_link_id: 0,
selection_phase: SelectionPhase::Ended,
hyperlink_regex_searches: RegexSearches::new(),
hyperlink_regex_searches: RegexSearches::new(
&path_hyperlink_regexes,
path_hyperlink_timeout_ms,
),
vi_mode_enabled: false,
is_remote_terminal,
last_mouse_move_time: Instant::now(),
Expand All @@ -606,6 +613,8 @@ impl TerminalBuilder {
cursor_shape,
alternate_scroll,
max_scroll_history_lines,
path_hyperlink_regexes,
path_hyperlink_timeout_ms,
window_id,
},
child_exited: None,
Expand Down Expand Up @@ -838,6 +847,8 @@ struct CopyTemplate {
cursor_shape: CursorShape,
alternate_scroll: AlternateScroll,
max_scroll_history_lines: Option<usize>,
path_hyperlink_regexes: Vec<String>,
path_hyperlink_timeout_ms: u64,
window_id: u64,
}

Expand Down Expand Up @@ -2163,6 +2174,8 @@ impl Terminal {
self.template.cursor_shape,
self.template.alternate_scroll,
self.template.max_scroll_history_lines,
self.template.path_hyperlink_regexes.clone(),
self.template.path_hyperlink_timeout_ms,
self.is_remote_terminal,
self.template.window_id,
None,
Expand Down Expand Up @@ -2404,6 +2417,8 @@ mod tests {
CursorShape::default(),
AlternateScroll::On,
None,
vec![],
0,
false,
0,
Some(completion_tx),
Expand Down Expand Up @@ -2452,6 +2467,8 @@ mod tests {
CursorShape::default(),
AlternateScroll::On,
None,
vec![],
0,
false,
0,
Some(completion_tx),
Expand Down Expand Up @@ -2527,6 +2544,8 @@ mod tests {
CursorShape::default(),
AlternateScroll::On,
None,
Vec::new(),
0,
false,
0,
Some(completion_tx),
Expand Down
Loading
Loading