Skip to content

LSP: When supported use snippet insert mode to add closing braces#114598

Open
HolonProduction wants to merge 1 commit intogodotengine:masterfrom
HolonProduction:lsp/snippet-insert-braces
Open

LSP: When supported use snippet insert mode to add closing braces#114598
HolonProduction wants to merge 1 commit intogodotengine:masterfrom
HolonProduction:lsp/snippet-insert-braces

Conversation

@HolonProduction
Copy link
Copy Markdown
Member

@HolonProduction HolonProduction commented Jan 4, 2026

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 GDScriptTextDocument to GDScriptLanguageProtocol because 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_deep to 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!

@HolonProduction HolonProduction force-pushed the lsp/snippet-insert-braces branch from b6a0175 to 7ab735f Compare March 25, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The extension only inserts the opening parenthesis ( and does not auto-close it with ) Lsp autocompletion no close parenthesis

1 participant