tall-needle-56640
12/04/2020, 5:52 PMreadonly result: Promise<T>;
resolveResult!: (v: any) => void;
rejectResult!: (e: Error) => void;
constructor(program: () => Promise<T>) {
this.program = program;
this.result = new Promise<any>((resolve, reject) => {
this.resolveResult = resolve;
this.rejectResult = reject;
});
this.running = false;
}
resolveResult!: (v: any) => void;
rejectResult!: (e: Error) => void;
faint-table-42725
12/04/2020, 6:10 PMFunc<object, void> resolveResult
Task
and then needing to handle the success/failure of that task. /cc @lemon-agent-27707tall-needle-56640
12/04/2020, 6:30 PMAction<object>
.faint-table-42725
12/04/2020, 6:36 PMtall-needle-56640
12/04/2020, 6:37 PMresolveResult
& rejectResult
(seen here) are just declarations, right? Where are they initialized?lemon-agent-27707
12/04/2020, 7:11 PMresolveResult
and rejectResult
(the promise constructor runs the executor immediately https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise#Parameters)
The goal of linking these properties from the LanguageServer.result
property was to make it easy for other downstream consumers to interact with language server. In practice we don't really use the exposed promise and handle the lifetime a little more manually.
I would not feel constrained by this for the dotnet implementation, it's really just to make callbacks easier to manage in javascript.tall-librarian-49374
12/04/2020, 7:39 PM