-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript LanguageService plugin #408
Comments
Thank you for the suggestion @dcecile. I think it's really helpful that you pointed out this doesn't change compiler behavior and is only relevant for editors. This is somewhat related to #396 as the VSCode plugin could simply inject a language service plugin. Unfortunately it would need to change how the language service reads files (to allow for processors). In addition the linter runtime, each rule and every library (e.g. IIRC There's a somewhat related feature request microsoft/TypeScript#15589 to integrate linting functionality directly into TypeScript. Regarding your initial request of integrating with the compiler: That could be possible by wrapping |
The initial implementation is available in branch ls-plugin. It works, but has some rough edges. Blocked on merging #482 |
For those willing to test the LanguageService plugin: In about 3 hours there will be a new nightly release that includes the plugin. The documentation is located here: https://github.com/fimbullinter/wotan/blob/master/packages/mithotyn/README.md Note: to install the nightly release you need to execute npm install --save-dev @fimbul/wotan@next @fimbul/mithotyn@next
# or
yarn add -D @fimbul/wotan@next @fimbul/mithotyn@next Any kind of feedback is very much appreciated. |
@ajafff I tried out the LanguageService plugin and everything worked well! 👍 The Wotan errors show up as I type according to my Wotan config, and I can switch them to show as warnings using the plugin setting. In the process I also ran into a couple VS Code things... To find the plugin, I found that VS Code's TypeScript version definitely needs to be set to the workspace version from node_modules. By chance I'd moved this VS Code setting from a user setting to a workspace setting and apparently this "reverts" the setting (needs to be reactivated). I didn't realize this had happened until I went through the steps of running For VS Code's TypeScript support in general, unfortunately errors and warnings don't get shown for files that aren't open (tracked in microsoft/vscode#13953). So the same thing applies to Wotan as a TypeScript plugin. To see the Wotan errors, you need to actually open up the file. Making things more complicated, the Wotan plugin doesn't get run via |
@dcecile Thank you for the detailed feedback. I had a similar problem with VSCode silently reverting my setting to using the bundled TypeScript version instead of the workspace version. I guess that happened during an update. To fix this I'm putting together a VSCode plugin to automatically inject the LanguageService plugin when using the bundled TypeScript version. #396 basically tracks that. |
What do you think about having Wotan act as a plugin for the TypeScript compiler?
I'm imagining an ideal development loop that includes running lint checks continuously together with continuously compiling my TypeScript code.
If Wotan could be used as TypeScript compiler plugin (like tslint-language-service), then maybe this use case could be supported for
tsc --watch
, Webpack, or any other build system?Edit: Oops, it looks like TypeScript plugins aren't as powerful as I'd hoped, and wouldn't work for failing a
tsc
build...The text was updated successfully, but these errors were encountered: