fix: handle undefined disposables

This commit is contained in:
Jacob Kim 2025-08-05 16:18:44 -07:00
parent 1374574f30
commit 9924e868e0

View file

@ -45,7 +45,9 @@ export class JumpManager {
public dispose() {
// Dispose current decoration.
this._disposables.forEach((d) => d.dispose());
this._disposables.forEach((d) => {
if (d) d.dispose();
});
this._disposables = [];
}
@ -75,14 +77,6 @@ export class JumpManager {
document.lineCount - 1,
);
console.log(
"editor lines:",
document
.getText()
.split("\n")
.slice(startLine, endLine + 1),
);
// First check if we have enough lines in the document
if (endLine - startLine + 1 < completionLines.length) {
// Not enough lines in document, so content can't be identical.
@ -225,8 +219,7 @@ export class JumpManager {
}
// Dispose any active listeners.
this._disposables.forEach((d) => d.dispose());
this._disposables = [];
this.dispose();
// Reset the context.
await vscode.commands.executeCommand(