DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
83 stars 10 forks source link

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

Open php4fan opened 1 month ago

php4fan commented 1 month ago

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.

jakubmisek commented 1 month ago

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.