LSP: When supported use snippet insert mode to add closing braces#114598
Open
HolonProduction wants to merge 1 commit intogodotengine:masterfrom
Open
LSP: When supported use snippet insert mode to add closing braces#114598HolonProduction wants to merge 1 commit intogodotengine:masterfrom
HolonProduction wants to merge 1 commit intogodotengine:masterfrom
Conversation
73c0391 to
366e9b0
Compare
d4a9127 to
b6a0175
Compare
b6a0175 to
7ab735f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #96726 -> same idea but this time with client capability safeguards
Fixes #84549
Fixes godotengine/godot-vscode-plugin#997
LSP clients don't auto-close braces from insert texts (seems like unspecified territory). We can instead close them in the server and use the snippet insert mode to place the caret between the braces:
Screencast.From.2026-01-04.16-15-13.webm
If the client does not support snippet mode we fall back to this behaviour:
Screencast.From.2026-01-04.16-13-45.webm
Implementation wise I moved the endpoint implementation from
GDScriptTextDocumenttoGDScriptLanguageProtocolbecause access to the client is more convenient from there and this whole structure is something we should flatten out eventually anyway.The implementation also contains a utility template
get_deepto safely get a deeply nested value from a dictionary with the necessary safeguards. If we already have something like this somewhere feel free to tell me!