TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_topLevel.ts
Andrew Branch 71bec5b698
Add quick fix to add missing 'await' (#32356)
* Start prototyping addMissingAwait codefix

* Filter by diagnostics that have missing-await related info

* Start writing tests and checking precedence

* Implement codeFixAll, add test for binary expressions

* Add test for iterables

* Add test for passing argument

* Add test for call/construct signatures

* Add test for awaiting initializer

* Improve assertion error

* Replace specific property access error with general one and add await related info

* Add test for property access

* Require code to be inside a function body to offer await

* Accept suggestion

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Add explicit test for code fix being not available unless something is a Promise

* Skip looking for function body if already in AwaitContext flags

* Inline getCodeActions function for symmetry
2019-07-12 10:07:55 -07:00

11 lines
320 B
TypeScript

/// <reference path="fourslash.ts" />
////declare function getPromise(): Promise<string>;
////const p = getPromise();
////while (true) {
//// p/*0*/.toLowerCase();
//// getPromise()/*1*/.toLowerCase();
////}
verify.not.codeFixAvailable("addMissingAwait");
verify.not.codeFixAvailable("addMissingAwaitToInitializer");