Search code examples
visual-studio-codeautocompletevscode-extensionsvscode-remote

VSCode unwantedly inserts and modifies PHP source code (autocomplete?)


In my environment, VSCODE runs on MacOS, but editing is primarily done via SSH on remote systems. I moved to the latest version of MacOS (Sequoia 15.0) this week and (among other things) this required me to update (read: reinstall) my vscode implementation. That has not been without its pains.

One primary pain source is that (apparently) PHP Intellphense (or other) makes code suggestions (sometimes very off-the-wall suggestions), seemingly randomly, and if I so much as press the space bar, the 'suggested' code is inserted. I have not yet been able to determine the source of this. I hope someone might recognize the effect, and I might be led in the right direction here on SO to turn that function off. in the following example, I simply typed } else { and pressed ENTER. I have no idea how it came up with code suggestion that appeared in the else block... but if I pressed space bar, it would be inserted. I am a fast typist and this happens more often than you might think.

unwanted code

A secondary nuisance is that the PHP function parameter names are inserted within the code (visual only, not stored). Not just some select parameters, but all of them. So what I am looking at is not the actual code. Maybe useful for some, but I want to see (only) what the code actually looks like, especially on lines I'm not actively changing. This messes up with alignment and a number of other cosmetic aspects of the code, and I'd like to turn it off. Here is an example of that. The words 'key: ' and 'array: ' are NOT in my code here.

Unwanted tags

Note: If you need a list of extensions or whatnot, please suggest what you need; I will be happy to provide.


Solution

  • I found the answet to this in the settings. Or at least the answer to most of it. (On occasion, it still shows phantom code that space-bar will insert, but it's so much better now.)

    These following settings, I modified to address the questions above, and it seems to be working as I like:

    PHP › Inlay Hints › Parameters: By Reference (unchecked)
    PHP › Inlay Hints › Parameters: Enabled (unchecked)
    PHP › Inlay Hints › Types: Lambda Parameter (unchecked)
    PHP › Inlay Hints › Types: Return (Disable)
    PHP › Inlay Hints › Types: Suppress Variable From Literal (unchecked)