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

Declaration map support (.d.ts.map) to jump to source files #1344

Closed
kalvenschraut opened this issue May 24, 2022 · 13 comments · Fixed by volarjs/volar.js#24
Closed

Declaration map support (.d.ts.map) to jump to source files #1344

kalvenschraut opened this issue May 24, 2022 · 13 comments · Fixed by volarjs/volar.js#24
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first

Comments

@kalvenschraut
Copy link
Contributor

In my mono repo I am generating a bunch of .d.ts.map files when running my dev scripts and I am noticing that when I goto definition using the typescript language server it will jump to the .ts source file. While using volar in takeover mode it is jumping to the .d.ts file instead.

I can't find any documentation or other issues stating similar things so figured it either is not supported or there is some issue with my setup. Once I get more time I can get a repro going if this is more specific to my case.

@johnsoncodehk johnsoncodehk added the enhancement New feature or request label May 28, 2022
@gustavotoyota
Copy link

Bump. It took me nearly a month to find out this is a Volar problem.
This issue makes Go To Definition useless in typescript monorepos containing Vue apps.

@gustavotoyota
Copy link

Workaround for now is to use Typescript Vue Plugin instead of Take Over mode.

@johnsoncodehk
Copy link
Member

Could you provide minimal reproduction?

@gustavotoyota
Copy link

  1. Clone https://github.com/andrewthauer/ts-monorepo
  2. Run yarn install
  3. Run yarn build
  4. Open the file packages/web/src/index.ts
  5. With Take Over mode active, ctrl+click on doubleNumbers: It will take you to the build file (Bad)
  6. With Typescript Vue Plugin active, ctrl+click on doubleNumbers: It will take you to the source file (Good)

@johnsoncodehk johnsoncodehk added bug Something isn't working and removed enhancement New feature or request labels Oct 9, 2022
@johnsoncodehk
Copy link
Member

I just to remove project references and related settings for TypeScript LanguageService and it seems resolved the problem, but not sure if it cause to other problems, so I add a setting and you need clearly config "volar.vueserver.noProjectReferences": true in VSCode to enable this.

I will keep this issue open until confirm if this workaround is suitable.

@gustavotoyota
Copy link

It looks like it's now working with Take Over mode, thank you!

@kalvenschraut
Copy link
Contributor Author

kalvenschraut commented Oct 17, 2022

I am still having the same issues, but I am using coc-volar instead of the vscode extension. I think I was able to pass through the noProjectReferences correctly, but it still doesn't work for me. I don't use project references like in the first repro that was added.

@johnsoncodehk added a repro for my case here. If you are not experiencing my issue in vscode with that option enabled, then I must not have passed it down correctly. Otherwise that option doesn't fix it for my case.

@yaegassy
Copy link
Collaborator

yaegassy commented Oct 17, 2022

Hi @kalvenschraut, Update the coc-volar and give it a try. :CocUpdate

It appears that the volar.vueserver.noProjectReferences setting was missing from coc-volar.

@kalvenschraut
Copy link
Contributor Author

Hi @kalvenschraut, Update the coc-volar and give it a try. :CocUpdate

It appears that the volar.vueserver.noProjectReferences setting was missing from coc-volar.

Updated and appears to not be working with my setup still in my reproduction repo.

@kalvenschraut
Copy link
Contributor Author

I am still having the same issues, but I am using coc-volar instead of the vscode extension. I think I was able to pass through the noProjectReferences correctly, but it still doesn't work for me. I don't use project references like in the first repro that was added.

@johnsoncodehk added a repro for my case here. If you are not experiencing my issue in vscode with that option enabled, then I must not have passed it down correctly. Otherwise that option doesn't fix it for my case.

@johnsoncodehk were you able to replicate using my repro? Not sure if there is anything more on my end you would need.

@johnsoncodehk
Copy link
Member

@kalvenschraut It's because you have set up "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } } in packages/package-a/package.json, don't know why VSCode built-in TypeScript extension does not respect exports option, we have to check what is the correct behavior with exports.

You can config "paths": { "package-a": ["../package-a/src/index.ts"] } to packages/package-b/tsconfig.json as a workaround.

@blake-newman
Copy link
Member

should be resolved with: volarjs/volar.js#24

@johnsoncodehk johnsoncodehk added the good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first label Apr 2, 2023
@segevfiner
Copy link
Contributor

@blake-newman @johnsoncodehk Going to a Vue component in a library that has declaration maps doesn't seem to work in non-take over mode in Vue files, but it does work in ts files, which suggests there is still an issue with declaration map support in Volar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants