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 References - Where Imports Used #1485
Comments
Looks similar to the typescript find file references feature. We could probably port the feature. Some pointers if you're interested in implementing it. We can reference the core feature in https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/fileReferences.ts This is not an LSP standard feature. So we need to do something similar to https://github.com/sveltejs/language-tools/blob/1a84dc3118658aabe7136f49997a4ea4253cc09e/packages/svelte-vscode/src/extension.ts#L344 to send a custom request to the language server. This should replace the And on the language-server side. Add a class in the |
@jasonlyu123 could you post that url again, github is returning a 404 for me. I want to be helpful and try to implement this but definitely a little apprehensive about knowing nothing about the terminology, the codebase, and its history. Nevertheless, I'll see what I can do to help. |
Sorry, I probably copied a local branch lol. I can try to explain it more. LSP is short for language-server-protocal is a protocol for an editor to communicate with a language server in another thread/process for the language features. It's kind of like the API server and browser client in the web world. The vscode typescript extension doesn't use LSP. They use tsserver which is a custom language server that uses a similar concept. We don't use tsserver for typescript features but use typescript-language-service which is a lower-level API that the tsserver also runs on. Because the find file reference feature is a custom feature by the typescript extension. It's not in the LSP. We need to copy some of the code that runs on the VSCode side. To listen for the context menu command and invoke the UI. And port this calculation code to the language-server-side. To achieve that we need to add a custom endpoint in the language server to receive the custom request and wire it to the feature class. And that is what the link I misplaced is for. |
@jasonlyu123 I tried to understand what you said and begin with #1491 Is this sortof what you had in mind? There is still missing code and may need help proceeding. |
Description
I'm always frustrated when I always have to do a global file search in VSCode (ctrl + shift +F) in order to find out where a particular svelte component is used throughout the codebase. I do not assume it is imported with the same name so I will search by its path that I would expect to be in the import from
For example, given the example repo when I do a "Where Used" on Button.svelte, I would expect to see the following references
Proposed solution
Running the command would then provide you a similar window as below and drilling inside the folder structure would show you the import statement for the component (blue line)
Alternatives
Global VScode search in all files
Additional Information, eg. Screenshots
Sample repo https://github.com/Jojoshua/sveltejs-where-imports-used
Reference #1484
The text was updated successfully, but these errors were encountered: