SpyglassMC / Spyglass

Development tools for vanilla Minecraft: Java Edition data pack developers.
https://spyglassmc.com
MIT License
281 stars 30 forks source link

Use properly virtualized text documents in VSCode #1147

Open MulverineX opened 2 months ago

MulverineX commented 2 months ago

When using the language server within VSCode, use properly virtualized text documents, rather than virtual-uris

SPGoding commented 2 months ago

To properly implement this with best possible interoperability, we need to add a custom field in the LSP client->server initialization request for clients to indicate if they support opening virtualized text documents. The server should use the current virtual-uris implementation for go-to-definition requests on archive: URIs if the client does not indicate the capability, or send a custom server->client notification spyglassmc/open-virtual-text-document with { uri: string, content: string } params otherwise. vscode-extension should indicate the capability, implement a handler for the custom notification, and open the document virtually when needed.

(This is "👍 good first issue" in the sense that I wrote some instructions on various parts of the systems you'd need to touch, not that it is an easy one liner. Let me know if you have any questions.)