X Tutup
Skip to content

LSP: Improve insertion algorithm for resolving completion options#113031

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
HolonProduction:lets-put-a-hack-on-top-the-hack
Nov 25, 2025
Merged

LSP: Improve insertion algorithm for resolving completion options#113031
Repiteo merged 1 commit intogodotengine:masterfrom
HolonProduction:lets-put-a-hack-on-top-the-hack

Conversation

@HolonProduction
Copy link
Member

Fixes godotengine/godot-vscode-plugin#891
Fixes godotengine/godot-vscode-plugin#842

(The fixes comments are a bit hard to say for sure, since there are also some very inconsistent cases with outdated content in the LSP which can result in the same symptoms. See #105236 for fixes to those cases. Anyway this PR should fix the most common origin of the symptoms.)

Supersedes #107865

The approach from this PR fixes an additional edge case which the PR mentioned above does not fix:

node. # with this PR completion options shown in this situation will correctly resolve their docs

The code is basically iterating increasingly big prefixes left of the cursor. And if those prefixes happen to be prefixes of the symbol the symbol gets insert-merged into the line.

The issue is, that if no prefix matches, the code would just continue without inserting the symbol at all. (This is a very simplified explanation! The original source right of the cursor always stays untouched so some very specific conditions are needed for an issue to occur.)

The older PR tried to solve this by starting iteration one character right of the cursor to ensure there would always be a matching prefix. This PR instead falls back to just inserting the symbol in place, if there was no match.


I also added a comment trying to add some context to what this code is trying to do and why correctness isn't the highest priority.

@HolonProduction HolonProduction force-pushed the lets-put-a-hack-on-top-the-hack branch from 642ef89 to 14cde0f Compare November 22, 2025 00:03
@AThousandShips AThousandShips added this to the 4.6 milestone Nov 24, 2025
@Repiteo Repiteo merged commit 1788983 into godotengine:master Nov 25, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 25, 2025

Thanks!

@HolonProduction HolonProduction deleted the lets-put-a-hack-on-top-the-hack branch November 25, 2025 13:36
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.

Documentation in quick suggestion panel does not appear until a character is entered Autocomplete docs popup shows up blank and inconsistent.

4 participants

X Tutup