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 Misbehaves for Imported Variables in Svelte Files #3

Open
luis11011 opened this issue Aug 20, 2024 · 4 comments
Open

Comments

@luis11011
Copy link

I'm encountering an issue with the "Go to Definition" feature in Svelte files. When I try to go to the definition of a variable that is imported from another file, instead of navigating to the variable's actual definition, the feature takes me to the point in the file where the variable is imported.

This behavior occurs consistently and disrupts my workflow, as I need to manually locate the original definition.

Steps to Reproduce:

  1. Import a variable from another file into a Svelte component.
  2. Use the "Go to Definition" feature on the imported variable.
  3. Observe that the feature takes you to the import statement instead of the actual definition.

Expected Behavior:
The "Go to Definition" feature should navigate directly to the location in the original file where the imported variable is defined.

Actual Behavior:
The "Go to Definition" feature takes you to the import statement rather than the variable's definition.

Environment:

  • Zed version: Zed Dev 0.151.0
  • Extension version: 0.0.3
  • Svelte version: 3.59.2
  • OS: Microsoft Windows 11 Home 10.0.22631 22631
@Kae7in
Copy link

Kae7in commented Aug 22, 2024

Go to definition has completely stopped working for me in .svelte files in this most release of Zed 0.149.3.

@AlbertMarashi
Copy link
Contributor

AlbertMarashi commented Sep 9, 2024

This appears to no longer be an issue for me. Could you check whether Go to Definition is working for you in the newer zed versions? @Kae7in @luis11011

@olafurw
Copy link

olafurw commented Sep 23, 2024

Just installed Zed for the first time, added the svelte extension and hitting F12 or rightclick Go to Definition does nothing. Not on the component name or on the import.

@AlbertMarashi
Copy link
Contributor

have you added the following to your tsconfig.json compilerOptions.plugins and run npm i typescript-svelte-plugin @olafurw

        "plugins": [
            {
                "name": "typescript-svelte-plugin",
                // the following options can be set additionally; they are optional; their default values are listed here
                "enabled": true, // enables this plugin
                "assumeIsSvelteProject": false // if true, skip detection and always assume it's a Svelte project
            }
        ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants