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

Add watch mode for deno check #14858

Open
bxantus opened this issue Jun 13, 2022 · 16 comments
Open

Add watch mode for deno check #14858

bxantus opened this issue Jun 13, 2022 · 16 comments
Labels
--watch related to the watch feature of the CLI feat new feature (which has been agreed to/accepted) good first issue Good for newcomers help wanted community help requested

Comments

@bxantus
Copy link

bxantus commented Jun 13, 2022

For me it would make a lot of sense to run check in watch mode.
I think that adding check subcommand was a great idea, and running it in watch mode would provide the best development experience (at least for me). Also if I'm not mistaken it would check further edits faster, as typescript compiler is already warmed up after the first check.

deno check --watch
@bartlomieju bartlomieju added feat new feature (which has been agreed to/accepted) --watch related to the watch feature of the CLI labels Jun 13, 2022
@bartlomieju
Copy link
Member

For me it would make a lot of sense to run check in watch mode.
I think that adding check subcommand was a great idea, and running it in watch mode would provide the best development experience (at least for me).

Sure, makes sense; it should be fairly easy to implement.

Also if I'm not mistaken it would check further edits faster, as typescript compiler is already warmed up after the first check.

Not really - to do so, we'd need to rearchitecture the check command for --watch mode - that's because, currently --watch literally restarts the whole subcommand that it's watching - there's no state preserved between the runs. To implement what you're suggesting we'd instead have to keep a TSC isolate running (and to do that we'd probably need to implement a new TS host or reuse one used in the deno lsp). @kitsonk any thoughts on this?

@ChristianSiegert
Copy link

@bxantus, does deno run --check --watch do what you want?

@bxantus
Copy link
Author

bxantus commented Jun 20, 2022

No, it isn't the same.
Currently I'm using Deno for creating web apps (running in the browser). I find it much easier to use Deno tooling compared to node.js. So deno run would not work in this case. I would like to use deno check --watch like a compiler (the typescript compiler), checking if everything is ok. Then I bundle the scripts using esbuild.

Even if I developed a console app (running it with deno run), using deno check --watch would suit me better. As I want to check my code frequently, but run it only when I'm fully finished with my modifications.
That's why I'm in favor of removing checking by default from run, and using checks mostly while developing.

@bartlomieju bartlomieju added good first issue Good for newcomers help wanted community help requested labels Jun 20, 2022
@bartlomieju
Copy link
Member

Marked as "good first issue", since the naive approach should be very easy to implement based on existing subcommands with support for --watch.

@VishnuJin
Copy link
Contributor

@bartlomieju can you please assign this to me? I'll give it a try!

@bartlomieju
Copy link
Member

@bartlomieju can you please assign this to me? I'll give it a try!

I cannot assign you the issue, but feel free to pick it up.

@cuobiezi
Copy link
Contributor

Can I take this one? I will try to finish is before next Monday.

@bartlomieju
Copy link
Member

@cuobiezi please do

@cuobiezi
Copy link
Contributor

cuobiezi commented Jul 28, 2022

@bartlomieju please refer #15325, But I don't know whether unit test is necessary , And I have no idea how to write unit test .I only tested it manually LOL.

@the-nikhil-jugdan
Copy link

Is this issue still open ? I would like pick it up

@kamilogorek
Copy link
Contributor

It appears to be implemented in #15325 but is not merged yet.

@the-nikhil-jugdan
Copy link

Okay, thanks for the info

@niedzielski
Copy link

Now that the bundle command is deprecated, I think this feature will be sorely wanted. I can bundle with esbuild instead which does have a watch API but to type-check, I think I still need something with import-aware watch abilities.

@jsejcksn
Copy link
Contributor

Now that the bundle command is deprecated, I think this feature will be sorely wanted. I can bundle with esbuild instead which does have a watch API but to type-check, I think I still need something with import-aware watch abilities.

@niedzielski I've advocated for a runtime type-checking API in #15478, which would be very helpful in the scenario that you described.

@birgersp
Copy link

It appears to be implemented in #15325 but is not merged yet.

the PR is deleted 😟

@forest1102
Copy link

Any progress here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--watch related to the watch feature of the CLI feat new feature (which has been agreed to/accepted) good first issue Good for newcomers help wanted community help requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.