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
31 stars 48 forks source link

feat: ensure langauge server does not crash with no default export #577

Closed codythomaszeitler closed 9 months ago

codythomaszeitler commented 10 months ago

What does this PR do?

It ensures that the LWC language server does not crash if an LWC file does not have a default export.

What issues does this PR fix or reference?

https://github.com/forcedotcom/salesforcedx-vscode/issues/4994

So, this change works in the following way.

It assumes that the lwc language server is adding information for just the "LWC" portion of a javascript file. (the stuff included in the default export). If it does not find an LWC, it simply returns an "empty" Internal Metadata definition to the vscode language server (since no LWC implies that no metadata information should be added to the language server).

CristiCanizales commented 9 months ago

Hi @codythomaszeitler! I'm so sorry for the delay, I didn't notice this PR before but until now that we have just merged a fix for the same issue 🤡 Thank you so much anyways for your contribution!