Ver código fonte

Fixes #2346 Fix duplicated inline annotations

In case of multiple cursors (selections) in the same line, an
annotation was created per selection, resulting in an odd experience.
Filter out duplicated lines by the line number.

Add author to CHANGELOG and README

Fixes: #2346
main
Yonatan Greenfeld 2 anos atrás
committed by Eric Amodio
pai
commit
1bf52c7e72
3 arquivos alterados com 14 adições e 14 exclusões
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -0
      README.md
  3. +12
    -14
      src/annotations/lineAnnotationController.ts

+ 1
- 0
CHANGELOG.md Ver arquivo

@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes [#2315](https://github.com/gitkraken/vscode-gitlens/issues/2315) - Commit details secondary side bar banner doesn't stay dismissed
- Fixes [#2329](https://github.com/gitkraken/vscode-gitlens/issues/2329) - Remember UI settings in Commit Details panel
- Fixes [#1606](https://github.com/gitkraken/vscode-gitlens/issues/1606) - Adjusts capitalization of "URL" — thanks to [PR #2341](https://github.com/gitkraken/vscode-gitlens/pull/2341) by Dave Nicolson ([@dnicolson](https://github.com/dnicolson))
- Fixes [#2346](https://github.com/gitkraken/vscode-gitlens/issues/2346) - Multiple cursors on the same line duplicate inline annotations; thanks to [PR #2347](https://github.com/gitkraken/vscode-gitlens/pull/2347) by Yonatan Greenfeld ([@YonatanGreenfeld](https://github.com/YonatanGreenfeld))
## [13.0.4] - 2002-11-03

+ 1
- 0
README.md Ver arquivo

@ -1226,6 +1226,7 @@ A big thanks to the people that have contributed to this project:
- Adaex Yang ([@adaex](https://github.com/adaex)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=adaex)
- Yan Zhang ([@Eskibear](https://github.com/Eskibear)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=Eskibear)
- Zyck ([@qzyse2017](https://github.com/qzyse2017)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=qzyse2017)
- Yonatan Greenfeld ([@YonatanGreenfeld](https://github.com/YonatanGreenfeld)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=YonatanGreenfeld)
Also special thanks to the people that have provided support, testing, brainstorming, etc:

+ 12
- 14
src/annotations/lineAnnotationController.ts Ver arquivo

@ -17,11 +17,11 @@ import type { LogScope } from '../logger';
import { Logger } from '../logger';
import { debug, getLogScope, log } from '../system/decorators/log';
import { once } from '../system/event';
import { count, every, filterMap } from '../system/iterable';
import { count, every, filter } from '../system/iterable';
import type { PromiseCancelledErrorWithId } from '../system/promise';
import { PromiseCancelledError, raceAll } from '../system/promise';
import { isTextEditor } from '../system/utils';
import type { LinesChangeEvent, LineSelection } from '../trackers/gitLineTracker';
import type { LinesChangeEvent } from '../trackers/gitLineTracker';
import { getInlineDecoration } from './annotations';
const annotationDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
@ -250,17 +250,15 @@ export class LineAnnotationController implements Disposable {
.join()}`;
}
const commitLines = [
...filterMap<LineSelection, [number, GitCommit]>(selections, selection => {
const state = this.container.lineTracker.getState(selection.active);
if (state?.commit == null) {
Logger.debug(scope, `Line ${selection.active} returned no commit`);
return undefined;
}
return [selection.active, state.commit];
}),
];
const commitLines = new Map<number, GitCommit>();
for (const selection of selections) {
const state = this.container.lineTracker.getState(selection.active);
if (state?.commit == null) {
Logger.debug(scope, `Line ${selection.active} returned no commit`);
continue;
}
commitLines.set(selection.active, state.commit);
}
const repoPath = trackedDocument.uri.repoPath;
@ -281,7 +279,7 @@ export class LineAnnotationController implements Disposable {
? options?.prs ??
this.getPullRequests(
repoPath,
commitLines.filter(([, commit]) => !commit.isUncommitted),
[...filter(commitLines, ([, commit]) => !commit.isUncommitted)],
{ timeout: timeout },
)
: undefined,

Carregando…
Cancelar
Salvar