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

TSC command returns no errors on Windows

Open JanPeter opened this issue 1 year ago • 1 comments

If I execute the :TSC command in neovim, it told me that no errors were found. While on my other Windows machine it did work properly. After trial and error I noticed that the on_stderr function was not implemented when the jobstart was called. I'm by no means a lua expert but did manage to show the error with adding the following to the opts table, I also had to comment the notify call - otherwise I couldn't see my message.

    err_buffered = true,
    on_stderr = function(_, data)
      vim.notify(vim.inspect(data))
    end,

I think someone who understands lua and neovim better should implement the error output in a proper way. My problem was that neovim wasn't able to execute the tsc command from my node_modules/.bin folder. It did work when I executed the same command directly from PowerShell. I'm not sure why but it seemed that neovim calls the old PowerShell while I'm only using the new PowerShell Core and I checked my ExecutionPolicy on PowerShell core which was set to RemoteSigned as people suggested in https://stackoverflow.com/questions/58796490/tsc-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system After I checked the old PowerShell it said that the ExecutionPolicy is set to restricted, which seemed to be the problem in my case. After I set it to RemoteSigned it does work now within tsc.nvim.

JanPeter avatar Mar 31 '24 09:03 JanPeter

Thanks for opening an issue and sorry you ran into this!

I think it might be worse doing two things

  1. Implementing stderr handling
  2. Implementing OS detection and invoking tsc.cmd instead of tsc based on that SO thread

I've got a tiny back log of items to get done w/ tsc.nvim and not quite sure when I'm going to get around to them (hopefully sometime in the next few weeks), but I definitely think this is worthwhile.

If anyone wants to take a shot at this it would be much appreciated!

dmmulroy avatar Mar 31 '24 18:03 dmmulroy