forethought
forethought

Reputation: 3253

How to change all occurrences of variable name in Visual Studio Code for PHP?

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

Upvotes: 4

Views: 30068

Answers (3)

Adi Candra
Adi Candra

Reputation: 41

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

Upvotes: 4

Picard
Picard

Reputation: 4102

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.

Upvotes: 3

Brynden
Brynden

Reputation: 37633

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).

Upvotes: 4

Related Questions