Cannot open JS file in LWC component

Issue #2156 resolved
Marcin Zabadaj created an issue

When LWC component contains a few JS file, I cannot open JS file that name differs from LWC component - IntelliJ is opening meta-xml file instead. E.g. When I have LWC component named myComponent and this component contains below files:

  • myComponent.html
  • myComponent.js
  • myComponentHelper.js
  • myComponent .js-meta.xml

Then I cannot open myComponentHelper.js file. I’m redirected to myComponent .js-meta.xml

Comments (6)

  1. Scott Wells repo owner

    Hi. I apologize but I'm unable to reproduce this behavior:

    Issue_2156.png

    I did the following in my attempt to reproduce:

    1. Right-clicked the lwc directory, and clicked New > Lightning Web Component and entered a component name of myComponent. That of course created myComponent (directory), myComponent/myComponent.html, myComponent/myComponent.js, and myComponent/myComponent.js-meta.xml.
    2. Right-clicked the myComponent directory and then clicked New > Lightning Web Component JavaScript File. I entered a class name of MyComponentHelper which created myComponent/myComponentHelper.js. Note that I also verified that this works properly when I instead use New > JavaScript File and enter a filename of myComponentHelper.js.
    3. Closed all tabs and double-clicked myComponent/myComponentHelper.js in the project view. The view shown in the screenshot above was displayed.

    I guess as a first check, can you confirm that you're on the latest build of IC2? If not, please update and see if the same issue is still present. If so, are these the same steps you followed? If not, what are your steps to reproduce? Also, can you please attach your project's .iml file for review and specify the project root-relative path to the myComponent bundle directory so I can confirm that it's under a configured source root?

  2. Marcin Zabadaj reporter

    @Scott Wells After I reinstalled IntelliJ - the issue disappeared. Thanks for your support.

  3. Scott Wells repo owner

    Glad to hear. Thanks for letting me know it's resolved for you. Out of curiosity, were you on an older version of IC2 before reinstalling? I'm just trying to determine whether there was an issue with the latest version, albeit resolved by reinstall, or if it was due to being on an older version where this problem did in fact exist.

  4. Marcin Zabadaj reporter

    I was working on IntelliJ v.2022.1.3, and Illuminated Cloud v.2.2.2.7. Now I’m using IntelliJ v.2022.1.4 and the same version on IC. To be honest I don’t know why reinstalling the IDE resolved the issue, because my software was up-to-date. Maybe there was an issue in the IntelliJ core? Fortunately, this issue doesn't occur now.

  5. Scott Wells repo owner

    Okay, thanks for letting me know. I wouldn't expect that minor version difference to factor in. Definitely let me know if you see such behavior again.

  6. Log in to comment