Skip to content

completion: Fix completion for php variables

ide_completion_context_get_bounds does not include $ in the bounds so when we delete (begin, end) from the text buffer so we can insert the text provided by the completion we don't remove the $. For php this is problematic because the completion includes the $ prefix, so when we insert the completion we end up with 2 $.

For example $t triggers autocomplete with a proposal $tree, we apply the proposal and end up with $$tree.

This patch adds a workaround for this in the IdeLspCompletionProvider that moves the begin iter on character backward when the buffer has php as language.

Fixes #1641 (closed)

cc @chergert I'm pretty sure we've discussed a similar issue before but I don't remember what we concluded back then.

I haven't changed ide_completion_compute_bounds/is_symbol_char to include $ because then intelephense starts crashing for some reason. I couldn't really figure out why that would happen.

Edited by Peter Maatman

Merge request reports