Closed heyimalex closed 9 months ago
Thank you for your contribution! It's working well on my machine. Can you please bump up the version in your pull request? Great work!
Version bumped 👍
Published 2.2.2-beta.4 version with this change
published with 2.3.0
version on npm. Thanks for contribution!!!
Implementation of approach that I described in #62. TL;DR: Create a strict
LanguageService
in memory andgetSemanticDiagnostics
from it for all strict files.The
create
method in a plugin returns aLanguageService
, and aLanguageService
's entire view of the world is through aLanguageServiceHost
. By proxying onlygetCompilationSettings
onLanguageServiceHost
to addstrict: true
and creating a newLanguageService
from it, we create a perfect mirror of the stockLanguageService
but with strict enabled.Proxying the
LanguageServiceHost
was more difficult than the language server, asObject.keys(host)
did not return all required methods. I tried grabbing the methods to proxy by walking up the prototype chain, but ultimately I couldn't figure it out; every time I'd be missing some other property and get some variant of a "cant access x on undefined" exception in the tsserver logs. Using aProxy
seems to have done the trick, and I'm successfully using this in my work repo now.I also proxied
dispose
andcleanupSemanticCache
as they seemed important to theLanguageService
lifecycle. I have no idea if they're necessary.