mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
cancel n-1 request when resolving incomplete result sets, fixes #13835
This commit is contained in:
parent
46f347ba6a
commit
32c95a76e8
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue