4

I have tried Ctrl + F12 but it does not really work. It does not select $this-> for some reasons. Does anyone here know, how to do it?

Thanks in advance

forethought
  • 2,913
  • 2
  • 16
  • 26

3 Answers3

4

Currently, Visual Studio Code's support for PHP is limited (see here), and I was unable to locate a PHP language service extension for Visual Studio Code (you're welcome to look, too).

Visual Studio Code currently only comes bundled with language services for JavaScript and TypeScript.

According to Visual Studio Code's documentation, a language service is defined as follows:

Language services provide the code understanding necessary for features like IntelliSense (suggestions) and smart code navigation (Go to Definition, Find All References, Rename Symbol).

Brynden
  • 35,463
  • 2
  • 15
  • 21
  • I really like the background on this answer, but it doesn't quite feel like an answer. There is a similar question that might be useful for anyone that stumbles into this. It highlights more on rename binding: https://stackoverflow.com/questions/46731353/rename-refactoring-for-php-in-visual-studio-code – j.raymond Aug 08 '18 at 02:36
3

You can try the regular search and replace CTRL+SHIFT+H. VS Code provides preview for all planned replacements so it is done not that bad as you would expect.

Itchydon
  • 2,572
  • 6
  • 19
  • 33
Picard
  • 3,745
  • 3
  • 41
  • 50
3

This question is a bit old but, for anyone who stumbled upon here,

You could use PHP Refactor Tool extension: https://marketplace.visualstudio.com/items?itemName=st-pham.php-refactor-tool

note that this extension dependent on PHP intelephense: https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client

STA
  • 30,729
  • 8
  • 45
  • 59
Adi Candra
  • 31
  • 2
  • OMG thank you so much! This extension is perfect! Exactly what I was looking for (and boy was I looking long and hard). The only thing I was missing from PHPStorm. Now I can finally switch to VSCode for non-work related projects (at least), to go easy with the resource consumption on my vintage MacBook. I don't even care if this comment gets reported/deleted for being pointless, I'm just so happy and grateful I finally found this tool that I had to thank you. – matronator Sep 11 '22 at 04:51