Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostics are ignored for for await loops #12115

Closed
sant123 opened this issue Sep 17, 2021 · 2 comments · Fixed by #12116
Closed

Diagnostics are ignored for for await loops #12115

sant123 opened this issue Sep 17, 2021 · 2 comments · Fixed by #12116
Assignees
Labels
bug Something isn't working lsp related to the language server

Comments

@sant123
Copy link

sant123 commented Sep 17, 2021

Describe the bug
Using the await reserved word inside a normal function (without async) is not being warned by the IDE.

To Reproduce

  1. Paste the following code:
const listener = Deno.listen({ port: 8080 });

for await (const conn of listener) {
  handleConn(conn);
}

function handleConn(conn: Deno.Conn) {
  const httpConn = Deno.serveHttp(conn);
  for await (const event of httpConn) {
    event.respondWith(new Response("html", { status: 200 }));
  }
}
  1. Note there is no warning in using await in a normal function

Expected behavior

Show an error in the editor saying await is only permitted inside async functions

Screenshots

Running the code with deno run --allow-net mod.ts fails:

image

Versions

vscode: 1.60.1 deno: 1.14.0 extension: 3.9.1

@kitsonk kitsonk transferred this issue from denoland/vscode_deno Sep 17, 2021
@kitsonk kitsonk self-assigned this Sep 17, 2021
@kitsonk kitsonk added bug Something isn't working lsp related to the language server labels Sep 17, 2021
@kitsonk kitsonk changed the title Extension doesn't warn to add reserved word Diagnostics are ignored for for await loops Sep 17, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Sep 17, 2021

At one point, we had issues with TypeScript allowing for await loops due to TypeScript bugs. Those bugs were addressed but we still ignored those diagnostics. We should remove those diagnostics from the ignored diagnostics.

@sant123
Copy link
Author

sant123 commented Sep 17, 2021

At one point, we had issues with TypeScript allowing for await loops due to TypeScript bugs. Those bugs were addressed but we still ignored those diagnostics. We should remove those diagnostics from the ignored diagnostics.

Thank you !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp related to the language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants