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

Can plugins handle a custom request? #200

Open
mcchrish opened this issue Sep 8, 2024 · 2 comments
Open

Can plugins handle a custom request? #200

mcchrish opened this issue Sep 8, 2024 · 2 comments

Comments

@mcchrish
Copy link

mcchrish commented Sep 8, 2024

So it used to that vue language server handles the request volar/client/findFileReference to find reference of a SFC vue file.
https://github.com/volarjs/volar.js/blob/ea92d55c03a82bf4515da82384aeb339425b5874/packages/language-server/protocol.ts#L17

So far since vue language tools move to be a typescript plugin I haven't figured out how to make the same functionality work. As a start, I figure this request should now be passed to the vtsls server however it does not have a handler for such request. I assume the typescript plugin should then be responsible for it?

I guess the question here is if this issue should be handle by this server, or the plugin upstream.

@yioneko
Copy link
Owner

yioneko commented Sep 8, 2024

Currently the server does not support TS plugin to register new LSP request handler so request like volar/client/findFileReference won't be handled. The limitation is somehow inherited from the vscode extension, which does not expose api for other extensions to register new language features to get handled by the TS plugin.

But for the specific "find file references" feature, we do not need a handler for volar/client/findFileReference to make it work. An existing command typescript.findAllFileReferences of this server should automatically recognize references of Vue file if the vue plugin activated. However, there is a minor issue in the original extension to prevent the command from returning references of Vue file:
microsoft/vscode#200511 https://github.com/microsoft/vscode/blob/1b071a84f9ba6aaaecfc4a0e154a019daf5fc0da/extensions/typescript-language-features/src/languageFeatures/fileReferences.ts#L37-L41

The vue vscode extension workaround this by monkey patching the typescript extension and we might need a similar solution here.

@yioneko
Copy link
Owner

yioneko commented Sep 21, 2024

Since commit 0834c3b, you could just use command typescript.findAllFileReferences for the references of vue file.

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

2 participants