From 6998c03c59df9419d398338e346f4233eb7acf6c Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Thu, 25 Jul 2024 09:39:57 -0400 Subject: [PATCH] Document git permalinks (GitHub, Gitlab, Bitbucket, SourceHut, Codeberg, etc) (#15113) - Docs: Added "Copy Permalink to Line" and "Open Permalink to Line" --- crates/extensions_ui/src/extensions_ui.rs | 19 +++++++++++++++++++ docs/src/git.md | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index 5b268b45fda03c7aee98c92419e27153eba194a3..53f519736e217a27fc7901fffe55cfde7291d840 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -134,6 +134,7 @@ impl ExtensionFilter { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] enum Feature { Git, + OpenIn, Vim, LanguageBash, LanguageC, @@ -150,6 +151,19 @@ fn keywords_by_feature() -> &'static BTreeMap> { KEYWORDS_BY_FEATURE.get_or_init(|| { BTreeMap::from_iter([ (Feature::Git, vec!["git"]), + ( + Feature::OpenIn, + vec![ + "github", + "gitlab", + "bitbucket", + "codeberg", + "sourcehut", + "permalink", + "link", + "open in", + ], + ), (Feature::Vim, vec!["vim"]), (Feature::LanguageBash, vec!["sh", "bash"]), (Feature::LanguageC, vec!["c", "clang"]), @@ -957,6 +971,11 @@ impl ExtensionsPage { "Zed comes with basic Git support. More Git features are coming in the future.", ) .docs_url("https://zed.dev/docs/git"), + Feature::OpenIn => FeatureUpsell::new( + telemetry, + "Zed supports linking to a source line on GitHub and others.", + ) + .docs_url("https://zed.dev/docs/git#git-integrations"), Feature::Vim => FeatureUpsell::new(telemetry, "Vim support is built-in to Zed!") .docs_url("https://zed.dev/docs/vim") .child(CheckboxWithLabel::new( diff --git a/docs/src/git.md b/docs/src/git.md index c1768a04ed3f99dd074832d424106f87829c7e9e..3700e08c85d47d3df13280bbd0f6b95c9fe94df5 100644 --- a/docs/src/git.md +++ b/docs/src/git.md @@ -8,3 +8,21 @@ Zed currently supports the following Git features: - Git blame viewing More advanced Git features—like staging and committing changes or viewing history within Zed—will be coming in the future. + +## Git Integrations + +Zed integrates with popular Git hosting services to ensure that git commit hashes +and references to Issues / Pull Requests / Merge Requests become clickable links. +Zed currently support links to +[GitHub.com](https://github.com), +[GitLab.com](https://gitlab.com), +[Bitbucket.org](https://bitbucket.org), +[SourceHut.org](https://sr.ht) and +[Codeberg.org](https://codeberg.org). + +Zed also has a Copy Permalink feature to create a permanent link to a code snippet on your Git hosting service. +These links are useful for sharing a specific line or range of lines in a file at a specific commit. +Trigger this action via the [Command Palette](/docs/#command-palette) (search for `permalink`), +by creating a [custom key bindings](/docs/key-bindings#custom-key-bindings) to the +`editor::CopyPermalinkToLine` or `editor::OpenPermalinkToLine` actions +or by simply right clicking and selecting `Copy Permalink` with line(s) selected in your editor.