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

Support multiple controllers with the same identifier

Open mtownsend81 opened this issue 1 year ago • 1 comments

In our project, we have two controllers with the same identifier, they share a lot of views, targets etc and essentially do the same job in different contexts, so the identifier makes sense.

The LSP only supports the first found controller here: https://github.com/marcoroth/stimulus-lsp/blob/979f8cbbf72a379131777da5cfe303008187bb89/server/src/diagnostics.ts#L611

So n VS code it's showing errors for values that do exist etc

mtownsend81 avatar Jan 16 '25 11:01 mtownsend81

Hey @mtownsend81, thanks for reporting this. This is a tricky one, since it's super hard to figure out the context in which the multiple Stimulus applications are running.

I have started working on parsing out the different Stimulus applications in https://github.com/marcoroth/stimulus-parser/pull/137 but even then it's not trivial to determine which application should we used in which view file, unless you explicitly tell the LSP which application to use for a glob of view files.

In wonder if it would make sense to either implement that, or to just default to looking in all parsed Stimulus applications. The downside to the latter approach is that the accuracy goes down since we can't tell it for sure.

marcoroth avatar Jan 25 '25 08:01 marcoroth