-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
tsserver running entire .vue files #927
Comments
It's probably checking your file as TypeScript code because your filetype is something like |
Sure, sorry about that - I thought it was a feature request, didn't realize it was something that was already sorted out! Updated the original comment with my .vimrc config and the output of |
I don't know how to handle this, but I'll mark this as an enhancement which can be worked on at some point in the future. The way |
@w0rp Right, makes sense, and that's what I'd expect it to do :) .vue files are a special case (which is why I was wondering if this is maybe out of the scope of this project), but it would be amazing if we could get it working. And I'd be happy to try! |
If you can come up with something that'll work, give it a go. 👍 |
@kaicataldo any luck with your attempts? |
I unfortunately haven't had time to look into this yet. Still on my backlog of things to do! But if someone else can get to it first, please feel free. |
Ok, so this becomes a somewhat complex issue as Therefore, the only way I can see to use typescript is to parse the file on the way in, and on the way out (either through vim or some intermediate script). I'm not an expert here, so maybe @w0rp could provide some insight. Let's say I wrote a python or python3 compatible program to do this. I understand that vim supports Python scripts, but is there a "pluggable" way to provide some kind of middleware or wrapper around either |
To clarify, the |
Here's a popular Vue plugin for VS Code (it works really well!): https://github.com/vuejs/vetur Might be able to glean some info from that. |
Maybe someone who works with Vue could do something similar to whatever it is that does. |
For anyone trying to get this to work with Vue: I had to install Need to add it to your tsconfig.json:
Then, I configured Ale to pick up vue as typescript:
Voila, typechecking for vue files! |
I'll close this. That seems like the solution. You could also alias |
Awesome! Thanks for the solution @archseer. |
@archseer this almost works for me, except it doesn't seem to see my tsconfig.json file in the current dir. |
@cj I've come across the same thing I think, it doesn't run with the same tsconfig settings as vue-cli or Vetur would. Possibly related #1459 I narrowed it down further but forgot by now, I think it had something to do with the linter being ran on a single file instead of the project (with project-wide settings) |
@archseer I see you've used eslint in your example, have you managed to get tslint to work correctly? |
@cj Found a temporary patch vuejs/vetur#815 This comment worked for me vuejs/vetur#815 (comment) @dustinblackman I've had tslint working before but switched to eslint because of eslin-plugin-vue. |
Hello,
I get an error like this:
All ALEInfo, packages.json, some pices of vimrc, are written in that thread and I do not repeat here just to keep clean this thread. Any help is appreciated. |
https://github.com/posva/vim-vue/blob/master/ftplugin/vue.vim This plugin is screwing things up again. I'll fix this by allowing |
You should also delete your |
|
Woah, @w0rp is a superstar. Great job on this plugin. |
Thank you. From ALEInfo now I see
However I'm continuing linting the whole vue file. I noticed the ts-vue-plugin folder under node_modules quite empty (at least there is no index.js file as in the repository) maybe this is the problem?
|
Maybe that's the problem. I got this:
You seem to be missing the |
Yes it works! |
Not exactly the same problem, but related: I'm using ale and The only thing which does not work is resolving imports: I always get a module not found lint error for every component import. For example I have a import Component from "@/components/Component.vue" ... and I get the error ...
I also tried with relative imports ( The whole project compiles fine though, so this error only happens on linting inside vim with ale and |
Same here, and I confirm it is just a linting problem. |
Deleted - it was a misconfiguration on my side, please ignore it ... in regular |
I think I found a hint to the solution, it is a problem with ryo7000/vue-ts-plugin@e4f7c8c tries to fix it afaik, and the error goes away. Though with it I don't get a linting for an invalid import Component from "@/components/Component.vue" // no linting error, :+1:
import NotExistent from "@/components/wrongNameComponent.vue"
// no linting error even though the file does not exist
import NotExistent from "@/something/wrongName" // no .vue component
// correct linting error about module not found Looks like all Though in the case with an invalid .vue import the project does not compile, so this will be noticed for sure (even though there is no linting error). I think this definitely better than wrong linting errors. All in all looks like there's an update needed for |
Okay. Someone else might find the information useful. |
Meet to the same problem. Is there a solution to fix it ? |
I managed to make it work by installing
and in my
For the syntax highlighting I use |
@nbl7 Thanks bud! You saved my day! I assume you have this in your config file?
Because installing |
Hi! First off, thanks for all your work on ale. I love how everything just works out of the box!
I use TypeScript in Vue single file component (.vue) files. tsserver currently reports a bunch of errors because it is checking the entire contents of the file, rather than just the contents of the
script
tag (as is expected).Is there any way we could have it only check the contents of that tag? I know that might be out of the scope of this project. I believe other editor integrations run JavaScript/TypeScript linters on the contents of those tags only (unless ESLint is configured with a plugin to parse the
template
tag contents as well).I'd be happy to try to take a look at this if someone could point me in the right direction (though I'm not too familiar with VimScript). Thanks!
My ale .vimrc config:
Results of
:ALEInfo
:The text was updated successfully, but these errors were encountered: