MCPcopy Index your code
hub / github.com/microsoft/vscode-languageserver-node / trigger

Method trigger

client/src/utils/async.ts:27–53  ·  view source on GitHub ↗
(task: ITask<T>, delay: number = this.defaultDelay)

Source from the content-addressed store, hash-verified

25 }
26
27 public trigger(task: ITask<T>, delay: number = this.defaultDelay): Promise<T> {
28 this.task = task;
29 if (delay >= 0) {
30 this.cancelTimeout();
31 }
32
33 if (!this.completionPromise) {
34 this.completionPromise = new Promise<T>((resolve) => {
35 this.onSuccess = resolve
36 }).then(() => {
37 this.completionPromise = undefined;
38 this.onSuccess = undefined;
39 var result = this.task!();
40 this.task = undefined;
41 return result;
42 });
43 }
44
45 if (delay >= 0 || this.timeout === void 0) {
46 this.timeout = setTimeout(() => {
47 this.timeout = undefined;
48 this.onSuccess!(undefined);
49 }, delay >= 0 ? delay : this.defaultDelay);
50 }
51
52 return this.completionPromise;
53 }
54
55 public forceDelivery(): T | undefined {
56 if (!this.completionPromise) {

Callers 2

didChangeMethod · 0.80
notifyFileEventFunction · 0.80

Calls 1

cancelTimeoutMethod · 0.95

Tested by

no test coverage detected