提交 32c95a76 编写于 作者: J Johannes Rieken

cancel n-1 request when resolving incomplete result sets, fixes #13835

上级 46f347ba
......@@ -146,6 +146,7 @@ export class SuggestModel implements IDisposable {
private quickSuggestDelay: number;
private triggerCharacterListeners: IDisposable[] = [];
private triggerFromIncompletePromise: TPromise<void>;
private triggerAutoSuggestPromise: TPromise<void>;
private state: State;
......@@ -249,6 +250,11 @@ export class SuggestModel implements IDisposable {
cancel(retrigger: boolean = false): void {
if (this.triggerFromIncompletePromise) {
this.triggerFromIncompletePromise.cancel();
this.triggerFromIncompletePromise = null;
}
if (this.triggerAutoSuggestPromise) {
this.triggerAutoSuggestPromise.cancel();
this.triggerAutoSuggestPromise = null;
......@@ -373,12 +379,16 @@ export class SuggestModel implements IDisposable {
private triggerFromIncomplete(auto: boolean): void {
this.requestPromise = provideSuggestionItems(this.editor.getModel(), this.editor.getPosition(),
if (this.triggerFromIncompletePromise) {
this.triggerFromIncompletePromise.cancel();
}
this.triggerFromIncompletePromise = provideSuggestionItems(this.editor.getModel(), this.editor.getPosition(),
this.editor.getConfiguration().contribInfo.snippetSuggestions,
this.completionModel.incomplete
).then(items => {
this.requestPromise = null;
this.triggerFromIncompletePromise = null;
if (this.state === State.Idle) {
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册