Add git blame
(#8889)
This adds a new action to the editor: `editor: toggle git blame`. When used it turns on a sidebar containing `git blame` information for the currently open buffer. The git blame information is updated when the buffer changes. It handles additions, deletions, modifications, changes to the underlying git data (new commits, changed commits, ...), file saves. It also handles folding and wrapping lines correctly. When the user hovers over a commit, a tooltip displays information for the commit that introduced the line. If the repository has a remote with the name `origin` configured, then clicking on a blame entry opens the permalink to the commit on the code host. Users can right-click on a blame entry to get a context menu which allows them to copy the SHA of the commit. The feature also works on shared projects, e.g. when collaborating a peer can request `git blame` data. As of this PR, Zed now comes bundled with a `git` binary so that users don't have to have `git` installed locally to use this feature. ### Screenshots    ### TODOs - [x] Bundling `git` binary ### Release Notes Release Notes: - Added `editor: toggle git blame` command that toggles a sidebar with git blame information for the current buffer. --------- Co-authored-by: Antonio <antonio@zed.dev> Co-authored-by: Piotr <piotr@zed.dev> Co-authored-by: Bennet <bennetbo@gmx.de> Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
e2d6b0deba
commit
7f54935324
39 changed files with 3760 additions and 157 deletions
|
@ -205,7 +205,10 @@ message Envelope {
|
|||
CountTokensWithLanguageModel count_tokens_with_language_model = 168;
|
||||
CountTokensResponse count_tokens_response = 169;
|
||||
UpdateChannelMessage update_channel_message = 170;
|
||||
ChannelMessageUpdate channel_message_update = 171; // current max
|
||||
ChannelMessageUpdate channel_message_update = 171;
|
||||
|
||||
BlameBuffer blame_buffer = 172;
|
||||
BlameBufferResponse blame_buffer_response = 173; // Current max
|
||||
}
|
||||
|
||||
reserved 158 to 161;
|
||||
|
@ -1784,3 +1787,48 @@ message CountTokensWithLanguageModel {
|
|||
message CountTokensResponse {
|
||||
uint32 token_count = 1;
|
||||
}
|
||||
|
||||
message BlameBuffer {
|
||||
uint64 project_id = 1;
|
||||
uint64 buffer_id = 2;
|
||||
repeated VectorClockEntry version = 3;
|
||||
}
|
||||
|
||||
message BlameEntry {
|
||||
bytes sha = 1;
|
||||
|
||||
uint32 start_line = 2;
|
||||
uint32 end_line = 3;
|
||||
uint32 original_line_number = 4;
|
||||
|
||||
optional string author = 5;
|
||||
optional string author_mail = 6;
|
||||
optional int64 author_time = 7;
|
||||
optional string author_tz = 8;
|
||||
|
||||
optional string committer = 9;
|
||||
optional string committer_mail = 10;
|
||||
optional int64 committer_time = 11;
|
||||
optional string committer_tz = 12;
|
||||
|
||||
optional string summary = 13;
|
||||
optional string previous = 14;
|
||||
|
||||
string filename = 15;
|
||||
}
|
||||
|
||||
message CommitMessage {
|
||||
bytes oid = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
message CommitPermalink {
|
||||
bytes oid = 1;
|
||||
string permalink = 2;
|
||||
}
|
||||
|
||||
message BlameBufferResponse {
|
||||
repeated BlameEntry entries = 1;
|
||||
repeated CommitMessage messages = 2;
|
||||
repeated CommitPermalink permalinks = 3;
|
||||
}
|
||||
|
|
|
@ -296,6 +296,8 @@ messages!(
|
|||
(LspExtExpandMacro, Background),
|
||||
(LspExtExpandMacroResponse, Background),
|
||||
(SetRoomParticipantRole, Foreground),
|
||||
(BlameBuffer, Foreground),
|
||||
(BlameBufferResponse, Foreground),
|
||||
);
|
||||
|
||||
request_messages!(
|
||||
|
@ -386,6 +388,7 @@ request_messages!(
|
|||
(UpdateWorktree, Ack),
|
||||
(LspExtExpandMacro, LspExtExpandMacroResponse),
|
||||
(SetRoomParticipantRole, Ack),
|
||||
(BlameBuffer, BlameBufferResponse),
|
||||
);
|
||||
|
||||
entity_messages!(
|
||||
|
@ -393,6 +396,7 @@ entity_messages!(
|
|||
AddProjectCollaborator,
|
||||
ApplyCodeAction,
|
||||
ApplyCompletionAdditionalEdits,
|
||||
BlameBuffer,
|
||||
BufferReloaded,
|
||||
BufferSaved,
|
||||
CopyProjectEntry,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue