forcedotcom / lightning-language-server

LWC and Aura Language Servers - shipped as part of the Salesforce VSCode Extensions
https://forcedotcom.github.io/salesforcedx-vscode/
BSD 3-Clause "New" or "Revised" License
33 stars 49 forks source link

feat: transition to @lwc/metadata for LWC JS introspection #570

Closed divmain closed 1 year ago

divmain commented 1 year ago

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:

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 issues does this PR fix or reference?

@W-13045347@

salesforce-cla[bot] commented 1 year ago

Thanks for the contribution! Before we can merge this, we need @divmain to sign the Salesforce Inc. Contributor License Agreement.