phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

Autocomplete suggestions often don't work inside of double-quoted string

Open php4fan opened this issue 1 year ago • 1 comments

I start with this code:

image

Note that the cursor is currently after the semicolon.

Now I place the cursor right after $foo and type an underscore:

image

It should suggest me to autocomplete $foo_bar, but it doesn't.

I even add a b:

image

Still nothing.

The only way to get all the expected suggestions is to delete everything after the $ and start typing the variable name from scratch again.

Here's the code for you to copy and paste and try:

<?php
$foo = 123;
$foo_bar = 456;

$s = "lalala $foo_b";

It's 100% systematically reproducible for me.

Outside of "" strings, it works as expected.

php4fan avatar Oct 01 '24 10:10 php4fan

thank you for the test case, you are correct.

Inside "" the VSCode does not tokenize the code, so it is up to us to trigger code completion in a very hacky way. We did it only after typing $ so far.

jakubmisek avatar Oct 07 '24 18:10 jakubmisek