Skip to content

Conversation

@rchl
Copy link
Member

@rchl rchl commented Dec 11, 2025

Want to get opinions about this solution.

Support priority_selector in a dict form where the keys are names of providers and values are selectors. There is also a special * key which acts as a fallback when no specific provider matches.

This allows to fix handling for renameProvider in LSP-vue where in text.html.vue scope (template block) LSP-vue should handle renaming while in text.html.vue source.js|ts LSP-typescript should handle renaming. The setting for this would look something like:

	"priority_selector": {
		"*": "text.html.vue, text.html.vue source.js, text.html.vue source.ts",
		"renameProvider": "text.html.vue",
	},

I'm making this a draft to get opinions before I do final touches and to also give me time to check handling for other providers in LSP-vue (want to make sure that all problematic cases can be fixed with this).

Fixes #2526

@rchl rchl marked this pull request as draft December 11, 2025 19:08
@netlify
Copy link

netlify bot commented Dec 11, 2025

Deploy Preview for sublime-lsp ready!

Name Link
🔨 Latest commit 280c929
🔍 Latest deploy log https://app.netlify.com/projects/sublime-lsp/deploys/693c1d9315dfcd0008358b8a
😎 Deploy Preview https://deploy-preview-2714--sublime-lsp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@predragnikolic
Copy link
Member

Rafal, I forgot the reason on why we need to redirect some request to vue and some to typescript. Can you maybe point me to some comment left by johnsoncodehk where he explained this? I know I read it somewhere but I cannot find it.

All I discovered this:
vuejs/language-tools#5456

How do I migrate to version 3?
Migrating to version 3 is quite simple, create a client handler for vue language server, when receiving the request, forward it to typescript language server and finally send the payload from typescript language server back to vue language server. We have an example for neovim users here.

FAQ
What's the request and response name I should handle/send to vue language server?
The request and response names are not configurable:

Request(receive from vue lsp): tsserver/request
Response(send to vue lsp): tsserver/response

@rchl
Copy link
Member Author

rchl commented Dec 11, 2025

Those specific requests that are problematic are not related to tsserver/request and tsserver/response. Those go directly to respective servers and are not redirected.

I don't know if I can provide much of a answer for why we need to do this. The fact is that some requests need to be handled by different servers depending on where in the document we are. Perhaps this is something that could be solved by the vue language server. Ideally all requests would go to vue server and then vue server would decide whether to redirect it to typescript server or respond directly. I suppose I should ask that question in their repo.

For the record, VSCode seems to ask one server and if server responds with empty response then it will try the next one.

@rchl
Copy link
Member Author

rchl commented Dec 12, 2025

inlayHintProvider case I can't fix with priority_selector since those are requested for whole document. Both LSP-vue and LSP-typescript provide different inlay hints:

Screenshot 2025-12-12 at 23 24 52

So here limiting inlay hints to one session does hurt the functionality...

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.

Multiple session and request handling

3 participants