I am developing a Drupal site using the latest official Drupal/PHP/Apache Docker image.

I have some local directories mapped to inside the Drupal container as expected (modules, profiles, sites, themes).

When I create a module and try to, for example, extend a Drupal class such as BlockBase, I get an error saying BlockBase is undefined. This is because the Drupal core code is inside of the container, which intelephense and intellisense can't see. Note the code is actually perfectly fine when it is run.

This problem also means I don't get any autocompletion or suggestions for methods and such.

Is there a way to resolve this issue, for example by somehow giving intelephense access to inside of the container?

Thank you.


You could use VS Code Remote Development.

Then extensions like Intelephense run in the container and see the entire code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.