-
-
Notifications
You must be signed in to change notification settings - Fork 592
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 fix Intellisense and go to definition for absolute path #423
Comments
Do you have jsconfig.json or tsconfig.json in your project? Have you configured path mapping in it? https://www.typescriptlang.org/docs/handbook/module-resolution.html |
Vue peek does awful guessing. https://github.com/fussinatto/vscode-vue-peek/blob/master/src/PeekFileDefinitionProvider.ts#L32 I don't like adding it. |
Yes.You are right.I tested is ok.Thanks a lot |
Thanks. We also welcome PR to add configuration example / instructions to doc. |
Sorry.I am wrong.I was success.But i don't know why doesn't working now.My computer is windows 10.I will test windows 7 tomorrow.But I want to give you some details. |
Can you change the lang to ts? It will show error if component isn't resolved. In case your mapping configuration is wrong. |
I had solve this problem.Sorry for wasted your time.Below is my final config.That is work very well for windows 10. |
H @HerringtonDarkholme @kinanson , i still experiencing some issue in Here some details Diretory:
jsconfig.json
|
@chocopowwwa
|
thanks for your reply @kinanson nope, that one doesn't work either ------ UPDATE ------ |
Hi, i have some problem.
PageContainer vue-peek found, mapperApi found, childApi not found. |
@edDimensi Vetur doesn't support eliding |
Why Vetur could not handle .vue file out of the box? It seems to be a main feature for an extension that aims to support Vue. @edDimensi you can workaround by adding a definition for Vue files: https://alexjoverm.github.io/2017/06/28/Integrate-TypeScript-in-your-Vue-project/#Troubleshooting But "going to definition" shortcut still won't work because it is now going to Vue internals! |
I don't like it. I don't think one should omit the extension. VSCode can use path completion so it even doesn't matter whether it requires four more key strokes. It also confuse users between plain script file and vue file. Also, you won't import a json/css file without extension. The same logic applies to vue, too. On the other hand, resolving file type without extension requires much more code and syscall on both editor plugin and webpack loader. ts-loader requires file extension to Unless one can list some objective advantages of omitting extension, I don't think vetur will support it. |
@HerringtonDarkholme I'm agree with you :) I prefer to let vue extensions too. I was talking about the need to add a definition to handle .vue files to avoid to have import errors in VS Code. If Vetur could handle this out of the box and could be able to link Vue files in script tags (like vue-peek does), it'd be great. |
Sadly vetur cannot change the behavior of TypeScript side. The only workaround is to add a declaration in type definition file. |
@cr0cK you can try this TypeScript langauge service plugin. https://github.com/HerringtonDarkholme/vue-ts-plugin You still need to configure TypeScipt, however. |
@HerringtonDarkholme I have this same problem, but cannot fix it with any of the solutions in the FAQs or here. As soon as I include the typings.d.ts file, Vetur won't recognise paths to modules in The culprit
|
@KokoDoko have you tried the vue ts plugin? |
Faced the very same issue as @alexsasharegan, workaround as for now is to create tsconfig.json in the root of your workspace and make it extend your base tsconfig.json. So, your root tsconfig.json should include one configuration line: {
"extends": "./path/to/your/real/tsconfig.json"
} After it, all the issues with missing aliased modules like #762 or #545 are gone, and TS type-checking and intellisense are working well in .vue files. Should work well for multi-root projects as well following the same logic. |
To expand on @evenfrost's post (thank you; it saved me a lot of time), the root folder in a multi-root workspace corresponds to the first folder in the workspace folder list in VSCode. So you would need to create the tsconfig.json file there that points to the tsconfig.json file in your web project in your workspace. Another solution for a multi-root workspace is to rearrange it so your web project folder comes first in the list. Vetur then seems to pick up the tsconfig.json file in that folder correctly. This is what I ended up doing after chasing this issue around for a few hours. 😄 |
Thanks @evenfrost, save my day |
Set VS Code user setting |
for those using vscode's multi root workspace feature: make sure the first workspace root is your vue project, otherwise vetur won't pick up on your tsconfig |
I might have a use case that addressing the original issue might be worth looking into. It's related to a Vue CLI plugin for Nativescript-Vue that will allow code sharing between Web and Native platforms in a single project. It does use Webpack Resolve Extensions to do the heavy lifting from the build side of things. I can open a new issue and reference this one if that would be better or I can continue in this issue with more details of the situation if you'd like. |
I use regular js (not ts) and I have this jsconfig.json and tsconfig.json in the root
|
Hey @artfabrique , what I see is the baseUrl seems strange, why is this
Maybe this helps! Cheers |
I'm on Windows10 and are you too? |
Nope, on mac. |
I'm having the same issue. I have a multi project workspace: with a I've put this in the client folder, and then also tried adding the "extends" jsconfig file at the root directory, like @evenfrost recommended.
Intellisense works perfectly without the '@/', so if I do something like Any suggestions? Would love Intellisense to work, and I feel like I'm so close! |
Also have this problem. Some time ago, VScode detects are error with |
For anyone interested, I just spent 2h on making my specific use case work with this issue of going to definition (+ autocompletion of methods and properties). My monorepo project:
As you can see I have several VueJS apps (independant from each others but everyone is dependant of core) and I wanted to ctrl+click into my imports in order to peek inside. My solutions is as follow: ./tsconfig.json
./packages/@configs/tsconfig.base.json
Everything is not perfect tho, sometimes it works, sometime it doesn't. I didn't make sense of that yet (seems like it needs an export to work, so functional components without scripts won't make it) but I finally have 80% of my files I can open through ctrl+click so it's a win. Hope it will help someone. :) |
@speyou Thanks the For anyone in the future looking for something simple:
|
Genius! |
WebStorm omits the file extensions by default (new project with Vue CLI). I can't find an IDE option to enforce extensions for |
Thank you, you saved my time. Deserve thumbs up! |
Vetur: Vue tooling for VS Code, but don't support this |
We don't want to support this. This feature will add more code, increase our maintenance pressure, and not sure if it will work well yet. |
This issue is a mixture of many questions, so I will lock this issue. |
Info
Problem
I know had go to definition for component and js file and 0.9.6 also had intellisense for component and props.But if i use absolute path that is not working.see below that is i mean.
import test from '@components/test.vue
I think that is possible.If I install Vue Peek.That can help me to definition even if i import absolute path.
I don't know what is "Find Definition for Vue components in ".If you want to imporve document thanks.
The text was updated successfully, but these errors were encountered: