Hello
I would like to hnow, as Visual Code does, how to obtain the instructions on a function ?
Regards
Hello
I would like to hnow, as Visual Code does, how to obtain the instructions on a function ?
Regards
If you are looking for hinting for built-in functions/methods.
Maybe PHP Completions Kit or IntelliDocs is enough for you. This is what I used before using LSP.
Setup a proper PHP language server will give you a comfortable coding experience. LSP not only hints for built-in things but also hints for your own code if you document them properly.
Steps:
Install the LSP package (language server client for ST).
Choose the PHP language server that you want to use. In my opinion, the most powerful one at this moment is intelephense. Its free features should be enough for basic users. Even premium license is at a cheap price. $10 = lifetime.
To install intelephense
, you have to install nodejs first. And then install intelephense
by $ npm -g i intelephense
.
Another PHP language server that I used before intelephense
is felixfbecker/language-server. It’s implemented in PHP natively so no need to install another env but its autocompletion is super slow on my side. And it looks like its development discontinued since the last commit is in 2018?
Configure your LSP settings for intelephense
:
{
// LSP servers configurations
"clients": {
"intelephense": {
// https://github.com/bmewburn/intelephense-docs
// npm -g i intelephense
// yarn global add intelephense
"enabled": true,
"command": [
"intelephense",
"--stdio",
],
"scopes": ["source.php", "embedding.php"],
"syntaxes": ["Packages/PHP/PHP.sublime-syntax"],
"languageId": "php",
"initializationOptions": {
"clearCache": false,
"licenceKey": "",
},
},
},
}
That’s it.