28

I had an issue where I installed Imagick via Pecl and Intelephense didn't know what to do with that extension and failed to show any code completion even though the extension was properly installed in the php.ini file and was working fine.
Some screenshots to bring clarity:

  1. Code where Imagick is used
  2. Bash output showing that the imagick extension is installed in the php.ini:
ddruganov@MBP-Demid:~$ php -i | grep imagick
imagick
imagick module => enabled
imagick module version => 3.4.4
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0
  1. Bash output showing where the extension is located:
ddruganov@MBP-Demid:~$ mdfind imagick.so
/usr/local/lib/php/pecl/20190902/imagick.so
ddruganov
  • 1,263
  • 13
  • 15
  • 2
    If you copy-paste code/shell text it will be easier to read while mantaining the post context and searchable. – reallynice Jun 08 '20 at 10:59

1 Answers1

79

Turns out intelephense just wasn't configured to know what this extension is.
The solution is very simple:

  1. Go to Intelephense extension settings in VSCode
  2. Go to a setting called 'Intelephense: Stubs'
  3. Add a new item named 'imagick'
  4. Save and close settings (though I believe they are saved
    automatically)
  5. Done

After all this is done, Intelephense shows all info about Imagick and auto-complete works just fine: proof

Hope this helps someone!

ddruganov
  • 1,263
  • 13
  • 15