bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.62k stars 94 forks source link

Add autocomplete suggestions for docblock types #2626

Closed black-corvus closed 1 year ago

black-corvus commented 1 year ago

Feature description or problem with existing feature I noticed that autocomplete shows available class names when typing the argument list of a function. But it doesn't show the class list when describing the arguments in the docblock above the function.

Describe the solution you'd like I would like the class list to pop up and suggest class names when typing out the argument types in the docblock. This should pop up when entering the type after @param, @returns, @throws and any other place where you might want to specify a type.

I don't know if this is possible or there if there is some kind of limitation in VSCode. It does look like VSCode is applying syntax highlighting to the types in the docblock and I can Alt-click on the type in the docblock to get to the class definition. And I believe this is powered by Intelephense. So I'm hoping getting the autocomplete to pop up for the docblock is possible.

Additional context For example, in the following screenshot, after typing the "A" after @param on line 7, I should get a pop-up suggesting Abc as a valid type.

Screenshot 2023-06-23 214704

jeffrey-kroonen commented 1 year ago

Hello,

I using PHP Intelephense in combinationwith the extension PHP DocBlocker.

When you type the class name after the @param, like @param User, you can use the key combination ctrl + space to start the autocomplete feature of PHP Intelephense and autocomplete the desired class/interface name.

image

I hope this solves your issue.

bmewburn commented 1 year ago

It should autocomplete in this context. You might have to switch on suggestions inside comments in the vscode settings.

"editor.quickSuggestions": {
  "other": true,
  "comments": true,
  "strings": true
}