How to disable the TypeScript Language Service for particular files?
Answered
I use a library that generates a TypeScript file. IntelliJ will show errors on this file if I open it, thus polluting my tree with red underlines. I cannot add @ts-ignore
s because the library regenerates the file on each run. I tried completely disabling it under Settings→Languages & Frameworks→TypeScript, and the errors go away. So, I think I want to disable the TypeScript Language Service on just that file.
What I have tried:
- Add the
--excludeFiles
flag under Options. - Add
“watchOptions”: { “excludeFiles”: […] }
intsconfig.json
.
How can I do this?
Please sign in to leave a comment.
Unfortunately there is no way to do this. Excluding files from
tsconfig.*
won't help when using Webstorm due to https://youtrack.jetbrains.com/issue/WEB-43179/Allow-excluding-ts-files-not-included-in-any-tsconfig.json-from-language-service-processing: if the file is not included in anytsconfig.json
, the IDE still uses tsserver to check themElena Pogorelova Thank you for your response. It looks like the issue you linked is under WebStorm. It should probably be more-so about the TypeScript plugin, right? Doesn't look like it has gained much attention.
Could this be accomplished with a plugin that modifies the TypeScript Language Service? Unfortunately, the TypeScript plugin is not open-source, so it would be difficult to integrate.
WebStorm is a host project for the Typescript plugin
No:(
Does the JetBrains license permit me to decompile the TypeScript plugin and rewrite it for personal use? Theorhetically, I could give it the same identifier.
But I'll contact the legal team to be sure