Skip to content

Commit 3f489ef

Browse files
committed
Defer viewport range calculation
1 parent bc867de commit 3f489ef

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/vs/workbench/contrib/terminal/browser/links/terminalLink.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
1212
import { isMacintosh } from 'vs/base/common/platform';
1313

1414
export class TerminalLink extends DisposableStore implements ILink {
15-
private _viewportRange: IViewportRange;
16-
1715
hideDecorations: boolean;
1816

1917
constructor(
2018
public readonly range: IBufferRange,
2119
public readonly text: string,
22-
viewportY: number,
20+
private readonly _viewportY: number,
2321
private readonly _activateCallback: (event: MouseEvent, uri: string) => void,
2422
private readonly _tooltipCallback: (event: MouseEvent, uri: string, location: IViewportRange, modifierDownCallback?: () => void, modifierUpCallback?: () => void) => boolean | void,
2523
private readonly _shouldHideDecorations: boolean = false,
2624
@IConfigurationService private readonly _configurationService: IConfigurationService
2725
) {
2826
super();
2927
this.hideDecorations = this._shouldHideDecorations;
30-
this._viewportRange = convertBufferRangeToViewport(range, viewportY);
3128
}
3229

3330
activate(event: MouseEvent, text: string): void {
@@ -55,12 +52,11 @@ export class TerminalLink extends DisposableStore implements ILink {
5552
this._tooltipCallback(
5653
event,
5754
text,
58-
this._viewportRange,
55+
convertBufferRangeToViewport(this.range, this._viewportY),
5956
this._shouldHideDecorations ? () => this.hideDecorations = false : undefined,
6057
this._shouldHideDecorations ? () => this.hideDecorations = true : undefined
6158
);
6259
this.dispose();
63-
// TODO: Use editor.hover.delay instead
6460
}, timeout);
6561
this.add(scheduler);
6662
scheduler.schedule();

0 commit comments

Comments
 (0)