ts-error-translator
ts-error-translator copied to clipboard
As a "Language Service Plugin" to have broad support for IDEs besides vscode
Hey 👋
So, just throwing random ideas here. Instead of a vscode extension or adding an additional package, this could be wrapped as a TypeScript Language Service Plugin.
Language Service Plugins allow to report additional errors such as from a linter and technically they should have access to original diagnostics so theoretically it'd be possible to add "translated" diagnostics along side original diagnostics.
Assuming this works, then user can simply add this to tsconfig:
{
"compilerOptions": {
"plugins": [{ "name": "ts-error-translator" }]
}
}
So any IDE that uses TypeScript language service would be able to load the plugin and report errors in that IDE's native way for displaying/reporting errors/messages.
I haven't personally written a TS language service plugin before, I'm slightly familiar with the APIs thought which I learned for no reason lol. If there is interest in this I could try this out when I get some time.
Yes, this makes sense - I don't think I'll be prioritising this myself because:
- It's kind of a 'power user' flow - most beginners don't know that TS plugins exist, or that they're an option. They can feel worried diving into
tsconfig.json
. - I want to target beginners, who are much more likely to get excited about and download an IDE extension.
I've written a simple plugin before and I think if there is a function to get the "better" error message from a diagnostic code / id / number, it should be pretty easy to write this plugin (just call the original and map over the results).
Where I think this would shine is in certain teams / big open-source repositories where beginners wouldn't add this plugin but more experienced users might and the beginners would benefit. They don't need to install anything, it will be set up for them. This could help convince people to use typescript over javascript.
This doesn't change my above state opinion, but I'm happy to leave this issue open if anyone else wants to work on this.
Anyone works on this or wants to? I want this in intellij
https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
Anyone ever started on this?
Anyone ever started working on this? Shame thrre is so little effort would love to look into this, get some people together on discord and build thid in an hour
I am happy to give it a go. @mattpocock @Jarrodsz
I am happy to give it a go. @mattpocock @Jarrodsz
Would love to help. its probably not overcomplicated. There is already a prisma extension for intellij