提交 2dd76931 编写于 作者: J Johannes Rieken

make sure to await showing of results, #65809

上级 08510a5b
......@@ -59,7 +59,7 @@ export class DefinitionAction extends EditorAction {
const model = editor.getModel();
const pos = editor.getPosition();
const definitionPromise = this._getTargetLocationForPosition(model, pos, CancellationToken.None).then(references => {
const definitionPromise = this._getTargetLocationForPosition(model, pos, CancellationToken.None).then(async references => {
if (model.isDisposed() || editor.getModel() !== model) {
// new model, no more model
......@@ -98,11 +98,11 @@ export class DefinitionAction extends EditorAction {
} else if (result.length === 1 && idxOfCurrent !== -1) {
// only the position at which we are -> adjust selection
let [current] = result;
this._openReference(editor, editorService, current, false);
return this._openReference(editor, editorService, current, false).then(() => undefined);
} else {
// handle multile results
this._onResult(editorService, editor, new ReferencesModel(result));
return this._onResult(editorService, editor, new ReferencesModel(result));
}
}, (err) => {
......@@ -128,7 +128,7 @@ export class DefinitionAction extends EditorAction {
return model.references.length > 1 && nls.localize('meta.title', " – {0} definitions", model.references.length);
}
private _onResult(editorService: ICodeEditorService, editor: ICodeEditor, model: ReferencesModel) {
private async _onResult(editorService: ICodeEditorService, editor: ICodeEditor, model: ReferencesModel): Promise<void> {
const msg = model.getAriaMessage();
alert(msg);
......@@ -136,14 +136,13 @@ export class DefinitionAction extends EditorAction {
if (this._configuration.openInPeek) {
this._openInPeek(editorService, editor, model);
} else {
let next = model.nearestReference(editor.getModel().uri, editor.getPosition());
this._openReference(editor, editorService, next, this._configuration.openToSide).then(editor => {
if (editor && model.references.length > 1) {
this._openInPeek(editorService, editor, model);
} else {
model.dispose();
}
});
const next = model.nearestReference(editor.getModel().uri, editor.getPosition());
const targetEditor = await this._openReference(editor, editorService, next, this._configuration.openToSide);
if (targetEditor && model.references.length > 1) {
this._openInPeek(editorService, targetEditor, model);
} else {
model.dispose();
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册