Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic: Calling application.register with a non-controller should warn you #204

Open
marcoroth opened this issue Mar 2, 2024 · 0 comments
Labels
diagnostic Feature that implements a `textDocument/diagnostic` request. enhancement New feature or request feature Issue that implements a new feature.

Comments

@marcoroth
Copy link
Owner

If you try to register something the Stimulus Parser cannot trace to a controller definition we should add a diagnostic to the application.register() call.

// app/javascript/controllers/index.js

import { application } from "./application"

import User from "./user_controller"

application.register("user", User)
/*                           ^^^^ 
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ The argument `User` couldn't be resolved to a Stimulus controller definition. Make sure you are      │
│ passing in a reference to a valid Stimulus controller definition.                                    │
│ Stimulus LSP (stimulus.controller.value.type.invalid)                                                │
├──────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  View Problem (⌥F8)   Quick-Fix... (⌘.)                                                              │
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/

@marcoroth marcoroth added enhancement New feature or request feature Issue that implements a new feature. diagnostic Feature that implements a `textDocument/diagnostic` request. labels Mar 2, 2024
@marcoroth marcoroth changed the title Diagnostic: Registering a non-stimulus with application.register should warn you Diagnostic: Calling application.register with a non-controller should warn you Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic Feature that implements a `textDocument/diagnostic` request. enhancement New feature or request feature Issue that implements a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant