Closed benfc1993 closed 7 months ago
Does this have any impact on users who don't enable the watch
option? Is it also possible to run this in non-watch mode and have tsc.nvim
find all of the monorepo projects and do a "one-shot" run on them?
Behaviour will not change for non watch users. It will still find the closest tsconfig when :TSC is run.
I like the idea of having this able to find all tsconfig files. As it could then run the job for each file found.
Would you want this to work for watch and non watch? So run :TSC in the root of a monorepo it should run for all tsconfigs no matter whether the watch flag is passed?
Yeah I think that would be desirable behavior, maybe we use a monorepo
flag in the config to enable rather it being the default (unless tsc
itself does this by default and tsc.nvim
just isn't handling it correctly)
Unfortunately tsc cli doesn't handle mono repos natively, suggested and rejected a few years ago. I do have a solution in the works, I'll get this working then make sure it can be put behind a flag. It will automatically find your tsconfigs and run a process per. I need to do some benchmarking on larger codebases to validate this not being too heavy but as they run in separate processes I don't think it will be much more overhead than running one.
I'll get it committed as soon as I can.
Thanks @benfc1993, super appreciate your thought, time, and contributions 💜🙏
Okay so old behaviour is completely maintained, the new mono repo behaviour is behind the run_as_monorepo
flag. I've listed the behaviour below to check you're good with the behaviours. I've limited the running tsc processes to 20, my machine was able to run more but I noticed a definite dip in performance after 20. However I can't imagine it being a real world consideration.
Let me know 👍
Will take a look tonight or first thing tomorrow morning! Thanks for the being so thorough and detailed.
I already have the best benefit of this great plugin. Thank you for all your work on making it to begin with.
This allows for multiple watch processes to be running simultaniously. It will only run one per tsconfig project. This will allow for mono repo projects to use watch across all sub repos. This does not change any existing functionality.
running TSC in an open buffer will find the nearest tsconfig file upwards. and if there is no process currently running against that project it will start one and log the job id. This can then be checked against on subsequent attempts to run tsc if it is in watch modAe.
I have also added a :TSCStop usrcmd to allow stopping all watching processes.