pmizio / typescript-tools.nvim

⚡ TypeScript integration NeoVim deserves ⚡
MIT License
1.5k stars 42 forks source link

Diagnostic on all workspace #62

Open adelin-b opened 1 year ago

adelin-b commented 1 year ago

Feature: get diagnostic from the whole workspace

Null ls implemented a way to get all error from the workspace, which is to run tsc --noEmit and parsing the result.

It's not very efficient and take a while. However launching in watch mode is instantaneous. Would it be possible to have the diagnostic instance running in watch mode here.

Thank you.

pmizio commented 1 year ago

It is possible tsserver has dedicated method for that, but as far as I know it is slow also and that's why vscode don't enable this by default. We can implement that and hide this behind some setting, just like vscode does it.

ecosse3 commented 1 year ago

@adelin-b For tsc I am using dmmulroy/tsc.nvim: A Neovim plugin for seamless, asynchronous project-wide TypeScript type-checking using the TypeScript compiler (tsc) and it works great.

adelin-b commented 1 year ago

It is possible tsserver has dedicated method for that, but as far as I know it is slow also and that's why vscode don't enable this by default. We can implement that and hide this behind some setting, just like vscode does it.

I wouldn't call that slow as this is the fastest update there is in the typescript ecosystem.

I just tried with tsc :

time npx tsc --noEmit --incremental
src/domains/assets/components/AssetsGallery/index.tsx:23:9 - error TS1005: ',' expected.

23 const A ssetsGallery = ({
           ~~~~~~~~~~~~

Found 1 error in src/domains/assets/components/AssetsGallery/index.tsx:23

npx tsc --noEmit --incremental  6,16s user 0,45s system 194% cpu 3,393 total

So running this command after editing a file would take 6 seconds

While if I update a file and watch

3sec

I takes 3 seconds to update.

@adelin-b For tsc I am using dmmulroy/tsc.nvim: A Neovim plugin for seamless, asynchronous project-wide TypeScript type-checking using the TypeScript compiler (tsc) and it works great.

And Im currently using null-ls that does this onsave https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#tsc So im looking for something more efficient and faster.

pmizio commented 1 year ago

It is definitely doable, we will see how it will perform. But it isn't highest priority right now. We have few plugin breaking bugs to fix 🙂

tpatalas commented 1 year ago

I am currently using none-ls/null-ls's TSC diagnostics, which allows the global (workspace) diagnostics. Because it is using tsserver, it is not compatible with typescript-tools. Not sure about this implementation, but this might help you implementing it.

https://github.com/jose-elias-alvarez/null-ls.nvim

pmizio commented 12 months ago

Sorry I missed your comment @tpatalas. I know like you see I tried to implement that but current plugin architecture cannot provide efficient implementation without loosing performance. I had this in mind in refactors.

tpatalas commented 11 months ago

Sorry I missed your comment @tpatalas. I know like you see I tried to implement that but current plugin architecture cannot provide efficient implementation without loosing performance. I had this in mind in refactors.

Performance is truly matter! Thank you for your effort