-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ESLint not working on .vue files #9934
Comments
Same on Zed 0.129.1 (Preview) Vue3 project |
Same thing .. last hurdle before i can really use this editor i think |
@mrnugget I know you’ve done a lot of work on ESLint, any chance of getting this in as it seems to be in high demand? |
This fixes #9934 and does two things: 1. It registers ESLint as a secondary language server for Vue.js files (`.vue`) 2. It registers ESLint as a _secondary_ (instead of primary) language server for TypeScript, JavaScript and TSX. The second point because I don't see any reason why ESLint should be registered as a primary language server for these languages. I read through the code in `project.rs` that uses the primary language server and I don't think there will be any differences to how it previously worked. I also manually tested ESLint support in a Vue.js project, a Next.js project and a plain old JS project — still works in all three.
PR is here: #10983 I tested it on a brand-new Vue.js project with ESLint in it and it works. Will go out next week Wednesday in the preview release. |
This fixes #9934 and does two things: 1. It registers ESLint as a secondary language server for Vue.js files (`.vue`) 2. It registers ESLint as a _secondary_ (instead of primary) language server for TypeScript, JavaScript and TSX. The second point because I don't see any reason why ESLint should be registered as a primary language server for these languages. I read through the code in `project.rs` that uses the primary language server and I don't think there will be any differences to how it previously worked. I also manually tested ESLint support in a Vue.js project, a Next.js project and a plain old JS project — still works in all three. Release Notes: - Added ESLint support for Vue.js files by starting it as a language server on `.vue` files. ([#9934](#9934)).
@mrnugget Just tested it. ESLint works perfectly fine, but just as a linter. It doesn't format the code like it does in "languages": {
"JavaScript": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
}
},
"TypeScript": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
}
},
"Vue.js": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
}
}
} |
It does work for me as a screenshot-2024-05-03-13.12.17.mp4Do you have anything in the logs? |
Update Formatting doesn't work for me in |
This was the moment I saved the file. |
Not sure what the exact problem is: should we format when there are errors? (we have other users who want us to disable formatting if there are errors, for example) should eslint format? |
In my opinion code styling rules (eslint lsp) and types (typescript lsp) should work independently. They’re used for different purposes. For example I want to add new functionality and I don’t wanna waste time writing types if I don’t even know if something is gonna work. In this case I have the situation when I have type errors, but I still would like for my formatter to work properly. Answering your question: yes, I think eslint should format the file even if there are typescript errors. |
Yeah, I'm not even sure whether that's the problem here. In your logs there's this:
I don't know whether this showed up when you hit save, but if it did, it seems like the code action doesn't work. Can you reproduce the issue with a fresh Vue.js project? |
Check for existing issues
Describe the bug / provide steps to reproduce it
I have a Vue2 project and ESLint does not provide error warnings for those files despite it providing them for other files e.g .js.
Environment
Zed: v0.128.3 (Zed)
OS: macOS 14.3.1
Memory: 8 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
ESLint and Vue LSP logs are both empty
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.N/A
The text was updated successfully, but these errors were encountered: