stimulus-parser icon indicating copy to clipboard operation
stimulus-parser copied to clipboard

Invalid Stimulus Controller with multiple layouts/js files

Open jaryl opened this issue 8 months ago • 7 comments

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.

jaryl avatar Jun 03 '24 02:06 jaryl