-
Notifications
You must be signed in to change notification settings - Fork 110
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
Can't load tsx-tide checker #328
Comments
I think it's only enabled for web-mode, not sure if it would work in derived mode |
This kind of makes sense. Thanks for the prompt reply. Since you probably know more about flycheck and web-mode than I do, I hope you don't mind me asking: If I have js, jsx, html, css, ts, tsx all bound to the same plain web-mode, how does flycheck know which checker to use? Does it actually look at the file extensions apart from the current major mode? |
There are two different checks, we will check if tide-mode is enabled and also check for file extension. You can search for |
Cheers, I will. In the end, I solved my problem with this code I tweaked (posted here to help other people):
So now I can enable tide in web-mode only if the file ends with .tsx, this is useful since I don't want to enable tide in, say .html and .css (both in web-mode). P.s. Closing issue since problem solved. |
A similar question I might as well ask here: would it be possible to have jsx-tide be enabled for all rjsx-mode regardless of the file extension (since I also code jsx syntax in js files, after hooking both .js and .jsx to rjsx-mode)? In other words, I want jsx-tide to be my checker for both .js files and .jsx files.
It seems to me that predicates play an important part in enabling checkers in flycheck (but I don't really understand the usecase of predicates). How do I interact with it? |
Looks like I missed this message.
No, the reason being how the checker is defined. tide explicitly adds a check for file extension. (flycheck-define-generic-checker 'jsx-tide
"A JSX syntax checker using tsserver."
:start #'tide-flycheck-start
:verify #'tide-flycheck-verify
:modes '(web-mode js2-jsx-mode rjsx-mode)
:predicate (lambda ()
(and
(tide-file-extension-p "jsx")
(tide-flycheck-predicate))))
(add-to-list 'flycheck-checkers 'jsx-tide t) But flycheck is extensible. You can just use the above config as template and define a new one with different name for rjsx-mode. Another options is to add |
Thanks for the reply! I see. To answer you question "because I thought rjsx is for editing jsx files only?", in modern web development (at least the projects I've taken part in), it's common to use a .js file extension yet still have jsx syntax in the code. Perhaps, tide would want to allow jsx-tide to also be enabled for both .js and .jsx files, but of course, that's entirely up to you. Feel free to close this issue if you find further discussions unnecessary. Have a nice day! |
I'm using rjsx-mode only for js files. But it can be used for jsx and js. BTW: thanks for this awesome package @ananthakumaran !!! |
I have the following defined for editing .tsx files:
Emacs tells me that tsx-tide is not a valid syntax checker, which is weird because if tide hasn't loaded up by then, how would the following two define-keys work? Strangely enough, tide-jump-to-definition and tide-jump-back work perfectly fine.
The text was updated successfully, but these errors were encountered: