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

Go to definition on Svelte component from ts file takes you to SvelteComponentDev interface #342

Closed
opensas opened this issue Jul 23, 2020 · 5 comments
Labels
feature request New feature or request Fixed Fixed in master branch. Pending production release.

Comments

@opensas
Copy link
Contributor

opensas commented Jul 23, 2020

Describe the bug

When you ctrl-click or right-click - Go to definition on a Svelte Component from a ts file you are taken to source code of the SvelteComponentDev Interface

To Reproduce

Create a new ts project:

npx degit sveltejs/template svelte-typescript-app
cd svelte-typescript-app
node scripts/setupTypeScript.js

Open vscode

Open main.ts

in the import App from './App.svelte'; line, ctrlk-click on App or on ./App.svelte

Expected behavior
Take you to the App.Svelte file, like what happens when you do it from a .svelte file

Screenshots
svelte-vscode-bug

System (please complete the following information):

  • OS: Ubuntu 18.04
  • IDE: vscode
  • Plugin/Package: "Svelte for VSCode"
@opensas opensas added the bug Something isn't working label Jul 23, 2020
@jasonlyu123
Copy link
Member

I don't know if this is possible. We currently don't provide any language feature on js/ts files. And the go to the definition is done by the typescript language feature of vscode. I don't know if there is any way to inject into their result.

@jasonlyu123 jasonlyu123 added feature request New feature or request and removed bug Something isn't working labels Jul 24, 2020
@jasonlyu123
Copy link
Member

Alternatively, anyone who wanted to quickly jump to the svelte file from any file. Use Ctrl+P to search the file.

@opensas
Copy link
Contributor Author

opensas commented Jul 24, 2020

I suppossed it wasn't going to be so easy to handle .ts files, just wanted to leave it here in case anybody finds out how to handle it.

BTW, great job, the plugin is marvellous!

dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue May 3, 2021
Initially support
- rename (doesn't work properly for all kinds of renames yet; need to filter out references inside generated code)
- diagnostics
- find references (need to filter out references inside generated code)

This makes all files TSX hardcoded for now, it seems the TS server is okay with importing tsx into js

sveltejs#580
sveltejs#550
sveltejs#342
sveltejs#110
dummdidumm added a commit that referenced this issue May 4, 2021
Initially support
- rename (doesn't work for prop renames yet)
- diagnostics
- find references
- go to definition
- go to implementation(s)

This makes all files TSX hardcoded for now, it seems the TS language server is okay with importing tsx into js

#580
#550
#342
#110
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label May 5, 2021
@dummdidumm
Copy link
Member

There exists a TypeScript plugin now which comes packaged with the VS Code extension and which you need to enable through the settings. It also is available standalone as a npm package if you need to use it outside of VS Code.
The plugin fixes this issue.

@CoolOppo
Copy link

CoolOppo commented Mar 8, 2022

I have it enabled in the settings and even added the standalone npm package as a plugin, but I still have the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

4 participants