Skip to content

Invalid Stimulus Controller with multiple layouts/js files #136

@jaryl

Description

@jaryl

I have two view layouts in my rails app, application and backend, which require a different set of stimulus controllers. I've created the necessary js files for it to include, and have set up my folder structure as such (simplified):

Screenshot 2024-06-03 at 10 47 24 AM

The actual codebase works, it loads the controllers and I can connect them as such. However, the LSP is flagging my data-[controller] attributes as invalid controllers, and the quick fix suggests I put my controllers in an extraneous controllers folder, as such:

Screenshot 2024-06-03 at 10 44 44 AM

How does Stimulus LSP infer which folders to look for controllers, the fact that it's suggesting two potential solutions indicates it does pick up my two configurations. I think that the extra "controllers" folder it requires may be a bug, or if there is a configuration option to change the folders where it thinks controllers should be, I'm not seeing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions