mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Constrains the active line hover to the start/end of a line
This commit is contained in:
@@ -326,41 +326,59 @@ export class BlameActiveLineController extends Disposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let decorationOptions: DecorationOptions | undefined = undefined;
|
let decorationOptions: [DecorationOptions] | undefined = undefined;
|
||||||
switch (activeLine) {
|
switch (activeLine) {
|
||||||
case 'both':
|
case 'both':
|
||||||
case 'inline':
|
case 'inline':
|
||||||
decorationOptions = {
|
const range = editor.document.validateRange(new Range(blameLine.line + offset, 0, blameLine.line + offset, 1000000));
|
||||||
range: editor.document.validateRange(new Range(blameLine.line + offset, 0, blameLine.line + offset, 1000000)),
|
decorationOptions = [
|
||||||
hoverMessage: hoverMessage,
|
{
|
||||||
renderOptions: {
|
range: range.with({
|
||||||
after: {
|
start: range.start.with({
|
||||||
contentText: annotation
|
character: range.end.character
|
||||||
},
|
})
|
||||||
dark: {
|
}),
|
||||||
|
hoverMessage: hoverMessage,
|
||||||
|
renderOptions: {
|
||||||
after: {
|
after: {
|
||||||
color: this._config.blame.annotation.activeLineDarkColor || 'rgba(153, 153, 153, 0.35)'
|
contentText: annotation
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
after: {
|
||||||
|
color: this._config.blame.annotation.activeLineDarkColor || 'rgba(153, 153, 153, 0.35)'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
light: {
|
||||||
|
after: {
|
||||||
|
color: this._config.blame.annotation.activeLineLightColor || 'rgba(153, 153, 153, 0.35)'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
} as DecorationInstanceRenderOptions
|
||||||
light: {
|
} as DecorationOptions,
|
||||||
after: {
|
// Add a hover decoration to the area between the start of the line and the first non-whitespace character
|
||||||
color: this._config.blame.annotation.activeLineLightColor || 'rgba(153, 153, 153, 0.35)'
|
{
|
||||||
}
|
range: range.with({
|
||||||
}
|
end: range.end.with({
|
||||||
} as DecorationInstanceRenderOptions
|
character: editor.document.lineAt(range.end.line).firstNonWhitespaceCharacterIndex
|
||||||
} as DecorationOptions;
|
})
|
||||||
|
}),
|
||||||
|
hoverMessage: hoverMessage
|
||||||
|
} as DecorationOptions
|
||||||
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'hover':
|
case 'hover':
|
||||||
decorationOptions = {
|
decorationOptions = [
|
||||||
range: editor.document.validateRange(new Range(blameLine.line + offset, 0, blameLine.line + offset, 1000000)),
|
{
|
||||||
hoverMessage: hoverMessage
|
range: editor.document.validateRange(new Range(blameLine.line + offset, 0, blameLine.line + offset, 1000000)),
|
||||||
} as DecorationOptions;
|
hoverMessage: hoverMessage
|
||||||
|
} as DecorationOptions
|
||||||
|
];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decorationOptions !== undefined) {
|
if (decorationOptions !== undefined) {
|
||||||
editor.setDecorations(activeLineDecoration, [decorationOptions]);
|
editor.setDecorations(activeLineDecoration, decorationOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user