tsc.nvim icon indicating copy to clipboard operation
tsc.nvim copied to clipboard

Ability to init with raw command instead of flags

Open AkisArou opened this issue 11 months ago • 6 comments

I have a monorepo where I use ts project references. I want to start the tsc from the nvim cwd (repo root dir), by executing "tsc --build /home/user/my-repo/tsconfig.json --watch".

I investigated the code, and I could not figure out a way to do this (specifically to define the path of tsconfig). Project references build command cannot be invoked with --project. I tried to trick it with bin_path option, but you check whether is executable. Via the flags you prepend double-dash.

Maybe you can provide a way to directly specify the command instead of the various options-flags? I think this may be the only way, because project references --build and rest args, should be placed in a specific order. (--build first, then tsconfig, then rest args).

Thanks! Nice plugin btw :)

AkisArou avatar Mar 23 '24 21:03 AkisArou

If the plugin respected the order of the flags in the config would that resolve this?

dmmulroy avatar Mar 26 '24 17:03 dmmulroy

I do not think so because you prepend -- at flags and in the command for ts project references, the arg for project tsconfig has none. I find it difficult to abstract away flags-options and args to cover all cases. That's why I proposed a raw command

AkisArou avatar Mar 26 '24 17:03 AkisArou

Yeah okay I see what you're saying - I'm going to be pretty busy for the next few weeks w/ some tight deadlines. If you want to take a shot at implementing I'm happy to iterate async with you. Appreciate you raising the issue!

dmmulroy avatar Mar 26 '24 19:03 dmmulroy

Ok I'll try to find time to implement it! Thanks

AkisArou avatar Mar 27 '24 11:03 AkisArou

Is the main issue that you want to run the TSC usrcmd and specify the path to the dir to use? If so would adding an option to specify a dir when running the TSC command work for you? Just thinking providing an option to hard code it in the package config would mean editing your nvim config whenever you change what you are working on.

The other option would maybe be the ability to provide a function which resolves to a string which can be run to set the location of the config when TSC is called?

benfc1993 avatar Mar 28 '24 21:03 benfc1993

Yes I think this will resolve it! This will contradict the project flag. Setting project = false so no default flag is used, will be needed.

AkisArou avatar Apr 01 '24 09:04 AkisArou