Johannes Rieken 2023-06-02 17:13:24 +02:00 committed by GitHub
parent 6d45c3610a
commit 3062c19c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 16 deletions

View file

@ -23,7 +23,11 @@ export class EditorHighlights<T> {
vscode.workspace.onDidChangeTextDocument(e => this._ignore.add(e.document.uri.toString())), vscode.workspace.onDidChangeTextDocument(e => this._ignore.add(e.document.uri.toString())),
vscode.window.onDidChangeActiveTextEditor(() => _view.visible && this.update()), vscode.window.onDidChangeActiveTextEditor(() => _view.visible && this.update()),
_view.onDidChangeVisibility(e => e.visible ? this._show() : this._hide()), _view.onDidChangeVisibility(e => e.visible ? this._show() : this._hide()),
_view.onDidChangeSelection(() => _view.visible && this.update()) _view.onDidChangeSelection(() => {
if (_view.visible) {
this.update();
}
})
); );
this._show(); this._show();
} }

View file

@ -18,7 +18,6 @@ export class Navigation {
this._disposables.push( this._disposables.push(
vscode.commands.registerCommand('references-view.next', () => this.next(false)), vscode.commands.registerCommand('references-view.next', () => this.next(false)),
vscode.commands.registerCommand('references-view.prev', () => this.previous(false)), vscode.commands.registerCommand('references-view.prev', () => this.previous(false)),
_view.onDidChangeSelection(() => this._ensureSelectedElementIsVisible()),
); );
} }
@ -31,20 +30,6 @@ export class Navigation {
this._ctxCanNavigate.set(Boolean(this._delegate)); this._ctxCanNavigate.set(Boolean(this._delegate));
} }
private _ensureSelectedElementIsVisible(): void {
if (this._view.selection.length === 0) {
return;
}
const [item] = this._view.selection;
const location = this._delegate?.location(item);
if (!location) {
return;
}
if (vscode.window.activeTextEditor?.document.uri.toString() !== location.uri.toString()) {
this._open(location, true);
}
}
private _anchor(): undefined | unknown { private _anchor(): undefined | unknown {
if (!this._delegate) { if (!this._delegate) {
return undefined; return undefined;