forcedotcom/lightning-language-server

Components with NavigationMixin aren't being parsed correctly to provide hover functionality

Opened this issue · 2 comments

Summary

While troubleshooting an issue where hover was consistently throwing an error, it was discovered that the root cause was coming from components using a Navigation Mixin. Those components are not providing information as they should. The root cause appears to be that we're incorrectly saving the customComponents.json index, but I didn't get much further while troubleshooting because #time.

Steps To Reproduce:

  1. Remove the code fix from #491.
  2. Activate the extensions in debug mode.
  3. Hover over a value in an HTML class, using a repo like the ebikes-lwc that uses NavigationMixin.
  4. See the error pop up in VS Code.
  5. Throw some debugger statements into lwc-data-provider.ts at the t.classMembers.forEach(cm => { line.
  6. Walk through until you get to a component like a NavigationMixin, that will be empty and have no data (will also throw the error).

Expected result

Components with Navigation Mixin should provide information like attribute and properties available.

Actual result

There was no className information available, causing an error downstream and not being included as helpful information.

Additional information

Example component not using NavigationMixin:
Screen Shot 2022-03-23 at 4 17 57 PM

Example component using NavigationMixin:

Screen Shot 2022-03-23 at 4 18 54 PM

@randi274 I've been experiencing this issue as well, but when developing components that apply OmniscriptBaseMixin to LightningElement.

lwc-language-server uses @lwc/compiler@0.34 - this version of the compiler doesn't recognise components that apply a Mixin to LightningElement as class components.

The latest version of the compiler seems to recognise a wider variety of class supertypes as valid components.

Thanks for chiming in! Updating lwc/compiler is on our short-term road map, so we're hoping to address these issues soon, and we'll add OmniscriptBaseMixin to our tests.