This PR removes the lwc-language-server dependency on an ancient version of the LWC compiler. Now, @lwc/metadata is leveraged to provide intelligence on LWC JavaScript in the IDE.
Initially, the plan was to entirely swap out the data structures underlying a lot of the logic in the language server. Instead of relying on the very old Metadata type, all logic would be updated to instead rely on new metadata types exposed by @lwc/metadata. However, the changes necessary to make this clean swap proved to be extremely invasive. Continuing down that path would have required a de facto rewrite, with all the inevitable subtle incompatibilities and bugs that come with such an endeavor.
As an alternative, we chose to provide a mapping of @lwc/metadata to the old metadata data structure, including all of its idiosyncrasies. This approach comes with some benefits:
the pre-existing behavior is reproduced ~exactly (or as close as we could come to it)
further iterations and refactors can leverage new LWC metadata without disrupting existing functionality
existing tests could be leveraged, adding confidence that this PR includes only non-breaking changes
it should allow lwc-language-server to stay up-to-date with future releases of LWC, with the possibility that small changes to the mapping might be rarely required
As a follow-up I'll work to configure our CI to run your test suite whenever we update @lwc/metadata. If successful, the LWC team will be alerted whenever we make breaking changes to your code. In such an event, we would either 1) avoid the break or 2) proactively inform you of the change.
What does this PR do?
This PR removes the
lwc-language-server
dependency on an ancient version of the LWC compiler. Now,@lwc/metadata
is leveraged to provide intelligence on LWC JavaScript in the IDE.Initially, the plan was to entirely swap out the data structures underlying a lot of the logic in the language server. Instead of relying on the very old
Metadata
type, all logic would be updated to instead rely on new metadata types exposed by@lwc/metadata
. However, the changes necessary to make this clean swap proved to be extremely invasive. Continuing down that path would have required a de facto rewrite, with all the inevitable subtle incompatibilities and bugs that come with such an endeavor.As an alternative, we chose to provide a mapping of
@lwc/metadata
to the old metadata data structure, including all of its idiosyncrasies. This approach comes with some benefits:lwc-language-server
to stay up-to-date with future releases of LWC, with the possibility that small changes to the mapping might be rarely requiredAs a follow-up I'll work to configure our CI to run your test suite whenever we update
@lwc/metadata
. If successful, the LWC team will be alerted whenever we make breaking changes to your code. In such an event, we would either 1) avoid the break or 2) proactively inform you of the change.What issues does this PR fix or reference?
@W-13045347@