diff --git a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts index 3f06e80bc69e0e0b282859fdb087ed435bd9d001..eb4fcb4e7fe9eec2d6ee8cb7b26a4dd8ab13578f 100644 --- a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts +++ b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts @@ -66,11 +66,16 @@ export class DefinitionAction extends EditorAction { const messageService = accessor.get(IMessageService); const editorService = accessor.get(IEditorService); - let model = editor.getModel(); - let pos = editor.getPosition(); + const model = editor.getModel(); + const pos = editor.getPosition(); return this._getDeclarationsAtPosition(model, pos).then(references => { + if (model.isDisposed() || editor.getModel() !== model) { + // new model, no more model + return; + } + // * remove falsy references // * find reference at the current pos let idxOfCurrent = -1;