Skip to content

Commit 7b99079

Browse files
committed
Avoids hover registration on untrackable files
Improves logging for hovers
1 parent ea20ef7 commit 7b99079

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/hovers/lineHoverController.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { CancellationToken, ConfigurationChangeEvent, Position, TextDocumen
22
import { Disposable, Hover, languages, Range, window } from 'vscode';
33
import type { Container } from '../container';
44
import { configuration } from '../system/-webview/configuration';
5+
import { isTrackableTextEditor } from '../system/-webview/vscode/editors';
56
import { debug } from '../system/decorators/log';
67
import { once } from '../system/event';
78
import { Logger } from '../system/logger';
@@ -81,6 +82,8 @@ export class LineHoverController implements Disposable {
8182
1: position => `${position.line}:${position.character}`,
8283
2: false,
8384
},
85+
exit: r => (r != null ? 'provided' : 'skipped'),
86+
singleLine: true,
8487
})
8588
async provideDetailsHover(
8689
document: TextDocument,
@@ -141,6 +144,8 @@ export class LineHoverController implements Disposable {
141144
1: position => `${position.line}:${position.character}`,
142145
2: false,
143146
},
147+
exit: r => (r != null ? 'provided' : 'skipped'),
148+
singleLine: true,
144149
})
145150
async provideChangesHover(
146151
document: TextDocument,
@@ -197,7 +202,7 @@ export class LineHoverController implements Disposable {
197202
private register(editor: TextEditor | undefined) {
198203
this.unregister();
199204

200-
if (editor == null) return;
205+
if (editor == null || !isTrackableTextEditor(editor)) return;
201206

202207
const cfg = configuration.get('hovers');
203208
if (!cfg.enabled || !cfg.currentLine.enabled || (!cfg.currentLine.details && !cfg.currentLine.changes)) return;

src/trackers/lineTracker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class LineTracker {
169169
return isIncluded(lineOrSelections, this._selections);
170170
}
171171

172-
if (this._selections == null || this._selections.length === 0) return false;
172+
if (!this._selections?.length) return false;
173173

174174
const line = lineOrSelections;
175175
const activeOnly = options?.activeOnly ?? true;

0 commit comments

Comments
 (0)