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

feat: Utilize DefinitionProvider to eliminate the need for navigating to .d.ts files #18

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Donovan-Ye
Copy link

Description

When using the plugin, I noticed that it redirects to the .d.ts file first. This can be inconvenient in certain situations, such as when trying to go back to a previous location and having to pass through the .d.ts file before returning to the original location.

I am refactoring the plugin to address this issue by rewriting the DefinitionProvider to resolve the definition of auto-imported components or other modules.

It seems to be working, but there is still an unresolved issue where multiple DefinitionProviders are used for the go to definition feature. This results in two or more definitions being found for auto imported modules, causing vscode to display a peek view by default. I have not found any vscode APIs that allow listening to the go to definition click event or the display of the peek view. As a workaround, I have set "editor.gotoLocation.multipleDefinitions": "goto", which automatically goes to the primary definition.

I have not rewritten the README.md yet due to limitations in this refactor. If this is acceptable or if there are other ways to address it, I can rewrite the README.md later.

@antfu
Copy link
Owner

antfu commented Jul 23, 2024

Interesting, thanks for working on it! Looks very promising but it seems this case it doesn't work: https://github.com/antfu-collective/vitesse-lite/blob/e41294c41017a18ca396bc9bf33556cf2c92712e/src/components/TheFooter.vue#L3 (toggleDark doesn't navigate to the source file)

Could you help to investigate a bit? Thanks!

@Donovan-Ye
Copy link
Author

Donovan-Ye commented Jul 23, 2024

Interesting, thanks for working on it! Looks very promising but it seems this case it doesn't work: https://github.com/antfu-collective/vitesse-lite/blob/e41294c41017a18ca396bc9bf33556cf2c92712e/src/components/TheFooter.vue#L3 (toggleDark doesn't navigate to the source file)

Could you help to investigate a bit? Thanks!

Thank you for responding! The issue was caused by a mismatch in the regex pattern, but it has been fixed.

@mdoesburg
Copy link

@antfu This seems promising. Any chance this is going to get merged?

@antfu
Copy link
Owner

antfu commented Oct 5, 2024

I see if it would require users to have "editor. geolocation.multipleDefinitions": "goto" - we should document it and probably also better to have a prompt to do it automatically for user.

Could you help on that? Thanks

@Donovan-Ye
Copy link
Author

I see if it would require users to have "editor. geolocation.multipleDefinitions": "goto" - we should document it and probably also better to have a prompt to do it automatically for user.

Could you help on that? Thanks

Let me try it 😄

@Donovan-Ye
Copy link
Author

A warning message is now displayed when users activate the extension for the first time. If users click 'OK', it will globally set "editor.gotoLocation.multipleDefinitions": "goto".

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

Successfully merging this pull request may close these issues.

3 participants