Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode autocomplete/intellisense for strings

While working with a PHP or JavaScript file in sublime, if I type the following code:

$test = "Scott";
If($test == null) {
    $test2 = "Scott"
}

When I typed in “$test2 = ‘Sc...” Sublime would autocomplete “Scott” since it was a word it found as a string in the current document scope.

However, when I do the same test in VSCode, it doesn’t pick it up or offer any suggestions. Is this possible in VSCode? I have already turned on the quicksuggestions to all true in the preferences. I am not sure what else I could do here or if there is an additional plugin that I need to download. Thanks!

like image 385
swhitlow Avatar asked Dec 18 '17 16:12

swhitlow


2 Answers

Like this?

word based suggestions

My settings:

intelephense extension enabled

{
  "editor.quickSuggestions": {
    "other": true,
    "comments": false,
    "strings": true
  },
  "editor.wordBasedSuggestions": true,
  "php.suggest.basic": false
}
like image 70
bmewburn Avatar answered Sep 22 '22 21:09

bmewburn


These are word based suggestions. They are controlled by the editor.wordBasedSuggestions setting.

However, word base suggestions will only show up when no valid language based suggestions are found (see https://github.com/Microsoft/vscode/issues/21611). JS should do the right thing inside strings here:

enter image description here

But the built-in php language support will still return language based suggestions inside strings, which is why the word based suggestions do not show up

like image 22
Matt Bierner Avatar answered Sep 23 '22 21:09

Matt Bierner