1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-07-11 14:30:24 +02:00

printer: add hyperlinks

This commit represents the initial work to get hyperlinks working and
was submitted as part of PR #2483. Subsequent commits largely retain the
functionality and structure of the hyperlink support added here, but
rejigger some things around.
This commit is contained in:
Lucas Trzesniewski
2023-07-08 00:56:50 +02:00
committed by Andrew Gallant
parent 86ef683308
commit 1a50324013
16 changed files with 1178 additions and 83 deletions

View File

@ -0,0 +1,23 @@
/// Aliases to well-known hyperlink schemes.
///
/// These need to be sorted by name.
pub const HYPERLINK_PATTERN_ALIASES: &[(&str, &str)] = &[
#[cfg(unix)]
("file", "file://{host}/{file}"),
#[cfg(windows)]
("file", "file:///{file}"),
// https://github.com/misaki-web/grepp
("grep+", "grep+:///{file}:{line}"),
("kitty", "file://{host}/{file}#{line}"),
// https://macvim.org/docs/gui_mac.txt.html#mvim%3A%2F%2F
("macvim", "mvim://open?url=file:///{file}&line={line}&column={column}"),
("none", ""),
// https://github.com/inopinatus/sublime_url
("subl", "subl://open?url=file:///{file}&line={line}&column={column}"),
// https://macromates.com/blog/2007/the-textmate-url-scheme/
("textmate", "txmt://open?url=file:///{file}&line={line}&column={column}"),
// https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls
("vscode", "vscode://file/{file}:{line}:{column}"),
("vscode-insiders", "vscode-insiders://file/{file}:{line}:{column}"),
("vscodium", "vscodium://file/{file}:{line}:{column}"),
];