diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d6aede..87386ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Added
+- Adds ability to show gutter heatmap in the gutter and/or on the scroll bar — closes [#297](https://github.com/eamodio/vscode-gitlens/issues/297)
+ - Adds `gitlens.heatmap.locations` setting to specify where the indicators of the gutter heatmap annotations will be shown
- Adds a `gitlens.fileAnnotations.command` setting to specify whether the file annotations button in the editor title shows a menu or immediately toggles the specified file annotations — closes [#1165](https://github.com/eamodio/vscode-gitlens/issues/1165) thanks to [PR #1171](https://github.com/eamodio/vscode-gitlens/pull/1171) by Raaj Patil ([@arrpee](https://github.com/arrpee))
- Adds this new option to the _Menus & Toolbars_ section of the GitLens Interactive Settings
diff --git a/README.md b/README.md
index 25073e0..f7ebbcf 100644
--- a/README.md
+++ b/README.md
@@ -836,6 +836,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| `gitlens.heatmap.ageThreshold` | Specifies the age of the most recent change (in days) after which the gutter heatmap annotations will be cold rather than hot (i.e. will use `gitlens.heatmap.coldColor` instead of `gitlens.heatmap.hotColor`) |
| `gitlens.heatmap.coldColor` | Specifies the base color of the gutter heatmap annotations when the most recent change is older (cold) than the `gitlens.heatmap.ageThreshold` value |
| `gitlens.heatmap.hotColor` | Specifies the base color of the gutter heatmap annotations when the most recent change is newer (hot) than the `gitlens.heatmap.ageThreshold` value |
+| `gitlens.heatmap.locations` | Specifies where the indicators of the gutter heatmap annotations will be shown
`gutter` - adds a gutter indicator
`overview` - adds a decoration to the overview ruler (scroll bar) |
| `gitlens.heatmap.toggleMode` | Specifies how the gutter heatmap annotations will be toggled
`file` - toggles each file individually
`window` - toggles the window, i.e. all files at once |
## Git Command Palette Settings [#](#git-command-palette-settings- 'Git Command Palette Settings')
diff --git a/images/heatmap.pdn b/images/heatmap.pdn
index e3d8f1f..d0c9f4c 100644
Binary files a/images/heatmap.pdn and b/images/heatmap.pdn differ
diff --git a/package.json b/package.json
index a862b18..d9ac8b1 100644
--- a/package.json
+++ b/package.json
@@ -355,7 +355,7 @@
]
},
"minItems": 1,
- "maxItems": 3,
+ "maxItems": 2,
"uniqueItems": true,
"markdownDescription": "Specifies where the indicators of the gutter changes annotations will be shown",
"scope": "window"
@@ -749,6 +749,29 @@
"markdownDescription": "Specifies the base color of the gutter heatmap annotations when the most recent change is newer (hot) than the `#gitlens.heatmap.ageThreshold#` value",
"scope": "window"
},
+ "gitlens.heatmap.locations": {
+ "type": "array",
+ "default": [
+ "gutter",
+ "overview"
+ ],
+ "items": {
+ "type": "string",
+ "enum": [
+ "gutter",
+ "overview"
+ ],
+ "enumDescriptions": [
+ "Adds a gutter indicator",
+ "Adds a decoration to the overview ruler (scroll bar)"
+ ]
+ },
+ "minItems": 1,
+ "maxItems": 2,
+ "uniqueItems": true,
+ "markdownDescription": "Specifies where the indicators of the gutter heatmap annotations will be shown",
+ "scope": "window"
+ },
"gitlens.heatmap.toggleMode": {
"type": "string",
"default": "file",
diff --git a/src/annotations/annotations.ts b/src/annotations/annotations.ts
index a067076..817410b 100644
--- a/src/annotations/annotations.ts
+++ b/src/annotations/annotations.ts
@@ -2,6 +2,7 @@
import {
DecorationInstanceRenderOptions,
DecorationOptions,
+ OverviewRulerLane,
Range,
TextEditorDecorationType,
ThemableDecorationAttachmentRenderOptions,
@@ -10,7 +11,8 @@ import {
Uri,
window,
} from 'vscode';
-import { configuration } from '../configuration';
+import { HeatmapLocations } from '../config';
+import { Config, configuration } from '../configuration';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { CommitFormatOptions, CommitFormatter, GitCommit } from '../git/git';
@@ -23,11 +25,6 @@ export interface ComputedHeatmap {
computeRelativeAge(date: Date): number;
}
-interface HeatmapConfig {
- enabled: boolean;
- location?: 'left' | 'right';
-}
-
interface RenderOptions
extends DecorationInstanceRenderOptions,
ThemableDecorationRenderOptions,
@@ -113,17 +110,25 @@ export class Annotations {
) {
const [r, g, b, a] = this.getHeatmapColor(date, heatmap);
+ const { locations } = Container.config.heatmap;
+ const gutter = locations.includes(HeatmapLocations.Gutter);
+ const overview = locations.includes(HeatmapLocations.Overview);
+
const key = `${r},${g},${b},${a}`;
let colorDecoration = map.get(key);
if (colorDecoration == null) {
colorDecoration = {
decorationType: window.createTextEditorDecorationType({
- gutterIconPath: Uri.parse(
- `data:image/svg+xml,${encodeURIComponent(
- ``,
- )}`,
- ),
- gutterIconSize: 'contain',
+ gutterIconPath: gutter
+ ? Uri.parse(
+ `data:image/svg+xml,${encodeURIComponent(
+ ``,
+ )}`,
+ )
+ : undefined,
+ gutterIconSize: gutter ? 'contain' : undefined,
+ overviewRulerLane: overview ? OverviewRulerLane.Center : undefined,
+ overviewRulerColor: overview ? `rgba(${r},${g},${b},${a})` : undefined,
}),
rangesOrOptions: [range],
};
@@ -159,7 +164,7 @@ export class Annotations {
static gutterRenderOptions(
separateLines: boolean,
- heatmap: HeatmapConfig,
+ heatmap: Config['blame']['heatmap'],
avatars: boolean,
format: string,
options: CommitFormatOptions,
diff --git a/src/config.ts b/src/config.ts
index d115716..e8d5940 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -63,6 +63,7 @@ export interface Config {
ageThreshold: number;
coldColor: string;
hotColor: string;
+ locations: HeatmapLocations[];
toggleMode: AnnotationsToggleMode;
};
hovers: {
@@ -215,6 +216,11 @@ export enum GravatarDefaultStyle {
Robot = 'robohash',
}
+export enum HeatmapLocations {
+ Gutter = 'gutter',
+ Overview = 'overview',
+}
+
export enum KeyMap {
Alternate = 'alternate',
Chorded = 'chorded',
diff --git a/src/webviews/apps/images/settings/heatmap-gutter.png b/src/webviews/apps/images/settings/heatmap-gutter.png
new file mode 100644
index 0000000..58cefcf
Binary files /dev/null and b/src/webviews/apps/images/settings/heatmap-gutter.png differ
diff --git a/src/webviews/apps/images/settings/heatmap-scrollbar.png b/src/webviews/apps/images/settings/heatmap-scrollbar.png
new file mode 100644
index 0000000..26c7a24
Binary files /dev/null and b/src/webviews/apps/images/settings/heatmap-scrollbar.png differ
diff --git a/src/webviews/apps/images/settings/heatmap.png b/src/webviews/apps/images/settings/heatmap.png
index 4856ff6..df09544 100644
Binary files a/src/webviews/apps/images/settings/heatmap.png and b/src/webviews/apps/images/settings/heatmap.png differ
diff --git a/src/webviews/apps/settings/partials/heatmap.html b/src/webviews/apps/settings/partials/heatmap.html
index 9e7f618..5e7a586 100644
--- a/src/webviews/apps/settings/partials/heatmap.html
+++ b/src/webviews/apps/settings/partials/heatmap.html
@@ -58,6 +58,36 @@
+