
This adds so-called "inline git blame" to the editor that, when turned on, shows `git blame` information about the current line inline:  When the inline information is hovered, a new tooltip appears that contains more information on the current commit:  The commit message in this tooltip is rendered as Markdown, is scrollable and clickable. The tooltip is now also the tooltip used in the gutter:  ## Settings 1. The inline git blame information can be turned on and off via settings: ```json { "git": { "inline_blame": { "enabled": true } } } ``` 2. Optionally, a delay can be configured. When a delay is set, the inline blame information will only show up `x milliseconds` after a cursor movement: ```json { "git": { "inline_blame": { "enabled": true, "delay_ms": 600 } } } ``` 3. It can also be turned on/off for the current buffer with `editor: toggle git blame inline`. ## To be done in follow-up PRs - [ ] Add link to pull request in tooltip - [ ] Add avatars of users if possible ## Release notes Release Notes: - Added inline `git blame` information the editor. It can be turned on in the settings with `{"git": { "inline_blame": "on" } }` for every buffer or, temporarily for the current buffer, with `editor: toggle git blame inline`.
259 lines
5.9 KiB
Rust
259 lines
5.9 KiB
Rust
//! This module contains all actions supported by [`Editor`].
|
|
use super::*;
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct SelectNext {
|
|
#[serde(default)]
|
|
pub replace_newest: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct SelectPrevious {
|
|
#[serde(default)]
|
|
pub replace_newest: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct SelectToBeginningOfLine {
|
|
#[serde(default)]
|
|
pub(super) stop_at_soft_wraps: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct MovePageUp {
|
|
#[serde(default)]
|
|
pub(super) center_cursor: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct MovePageDown {
|
|
#[serde(default)]
|
|
pub(super) center_cursor: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct SelectToEndOfLine {
|
|
#[serde(default)]
|
|
pub(super) stop_at_soft_wraps: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct ToggleCodeActions {
|
|
#[serde(default)]
|
|
pub deployed_from_indicator: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct ConfirmCompletion {
|
|
#[serde(default)]
|
|
pub item_ix: Option<usize>,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct ConfirmCodeAction {
|
|
#[serde(default)]
|
|
pub item_ix: Option<usize>,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct ToggleComments {
|
|
#[serde(default)]
|
|
pub advance_downwards: bool,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct FoldAt {
|
|
pub buffer_row: u32,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct UnfoldAt {
|
|
pub buffer_row: u32,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct MoveUpByLines {
|
|
#[serde(default)]
|
|
pub(super) lines: u32,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct MoveDownByLines {
|
|
#[serde(default)]
|
|
pub(super) lines: u32,
|
|
}
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct SelectUpByLines {
|
|
#[serde(default)]
|
|
pub(super) lines: u32,
|
|
}
|
|
|
|
#[derive(PartialEq, Clone, Deserialize, Default)]
|
|
pub struct SelectDownByLines {
|
|
#[serde(default)]
|
|
pub(super) lines: u32,
|
|
}
|
|
|
|
impl_actions!(
|
|
editor,
|
|
[
|
|
SelectNext,
|
|
SelectPrevious,
|
|
SelectToBeginningOfLine,
|
|
MovePageUp,
|
|
MovePageDown,
|
|
SelectToEndOfLine,
|
|
ToggleCodeActions,
|
|
ConfirmCompletion,
|
|
ConfirmCodeAction,
|
|
ToggleComments,
|
|
FoldAt,
|
|
UnfoldAt,
|
|
MoveUpByLines,
|
|
MoveDownByLines,
|
|
SelectUpByLines,
|
|
SelectDownByLines,
|
|
]
|
|
);
|
|
|
|
gpui::actions!(
|
|
editor,
|
|
[
|
|
AcceptPartialCopilotSuggestion,
|
|
AcceptPartialInlineCompletion,
|
|
AddSelectionAbove,
|
|
AddSelectionBelow,
|
|
Backspace,
|
|
Cancel,
|
|
ConfirmRename,
|
|
ContextMenuFirst,
|
|
ContextMenuLast,
|
|
ContextMenuNext,
|
|
ContextMenuPrev,
|
|
ConvertToKebabCase,
|
|
ConvertToLowerCamelCase,
|
|
ConvertToLowerCase,
|
|
ConvertToSnakeCase,
|
|
ConvertToTitleCase,
|
|
ConvertToUpperCamelCase,
|
|
ConvertToUpperCase,
|
|
Copy,
|
|
CopyHighlightJson,
|
|
CopyPath,
|
|
CopyPermalinkToLine,
|
|
CopyRelativePath,
|
|
Cut,
|
|
CutToEndOfLine,
|
|
Delete,
|
|
DeleteLine,
|
|
DeleteToBeginningOfLine,
|
|
DeleteToEndOfLine,
|
|
DeleteToNextSubwordEnd,
|
|
DeleteToNextWordEnd,
|
|
DeleteToPreviousSubwordStart,
|
|
DeleteToPreviousWordStart,
|
|
DisplayCursorNames,
|
|
DuplicateLineUp,
|
|
DuplicateLineDown,
|
|
ExpandMacroRecursively,
|
|
FindAllReferences,
|
|
Fold,
|
|
FoldSelectedRanges,
|
|
Format,
|
|
GoToDefinition,
|
|
GoToDefinitionSplit,
|
|
GoToDiagnostic,
|
|
GoToHunk,
|
|
GoToImplementation,
|
|
GoToImplementationSplit,
|
|
GoToPrevDiagnostic,
|
|
GoToPrevHunk,
|
|
GoToTypeDefinition,
|
|
GoToTypeDefinitionSplit,
|
|
HalfPageDown,
|
|
HalfPageUp,
|
|
Hover,
|
|
Indent,
|
|
JoinLines,
|
|
LineDown,
|
|
LineUp,
|
|
MoveDown,
|
|
MoveLeft,
|
|
MoveLineDown,
|
|
MoveLineUp,
|
|
MoveRight,
|
|
MoveToBeginning,
|
|
MoveToBeginningOfLine,
|
|
MoveToEnclosingBracket,
|
|
MoveToEnd,
|
|
MoveToEndOfLine,
|
|
MoveToEndOfParagraph,
|
|
MoveToNextSubwordEnd,
|
|
MoveToNextWordEnd,
|
|
MoveToPreviousSubwordStart,
|
|
MoveToPreviousWordStart,
|
|
MoveToStartOfParagraph,
|
|
MoveUp,
|
|
Newline,
|
|
NewlineAbove,
|
|
NewlineBelow,
|
|
NextInlineCompletion,
|
|
NextScreen,
|
|
OpenExcerpts,
|
|
OpenExcerptsSplit,
|
|
OpenPermalinkToLine,
|
|
OpenUrl,
|
|
Outdent,
|
|
PageDown,
|
|
PageUp,
|
|
Paste,
|
|
PreviousInlineCompletion,
|
|
Redo,
|
|
RedoSelection,
|
|
Rename,
|
|
RestartLanguageServer,
|
|
RevealInFinder,
|
|
ReverseLines,
|
|
RevertSelectedHunks,
|
|
ScrollCursorBottom,
|
|
ScrollCursorCenter,
|
|
ScrollCursorTop,
|
|
SelectAll,
|
|
SelectAllMatches,
|
|
SelectDown,
|
|
SelectLargerSyntaxNode,
|
|
SelectLeft,
|
|
SelectLine,
|
|
SelectRight,
|
|
SelectSmallerSyntaxNode,
|
|
SelectToBeginning,
|
|
SelectToEnd,
|
|
SelectToEndOfParagraph,
|
|
SelectToNextSubwordEnd,
|
|
SelectToNextWordEnd,
|
|
SelectToPreviousSubwordStart,
|
|
SelectToPreviousWordStart,
|
|
SelectToStartOfParagraph,
|
|
SelectUp,
|
|
ShowCharacterPalette,
|
|
ShowCompletions,
|
|
ShowInlineCompletion,
|
|
ShuffleLines,
|
|
SortLinesCaseInsensitive,
|
|
SortLinesCaseSensitive,
|
|
SplitSelectionIntoLines,
|
|
Tab,
|
|
TabPrev,
|
|
ToggleGitBlame,
|
|
ToggleGitBlameInline,
|
|
ToggleInlayHints,
|
|
ToggleLineNumbers,
|
|
ToggleSoftWrap,
|
|
Transpose,
|
|
Undo,
|
|
UndoSelection,
|
|
UnfoldLines,
|
|
UniqueLinesCaseSensitive,
|
|
UniqueLinesCaseInsensitive
|
|
]
|
|
);
|