Open Tristan-2i opened 2 years ago
Hi @Tristan-2i , there's no configuration necessary, but your cursor must be inside a set of PHP tags i.e.
<?php // Start typing a WordPress function name between PHP tags ?>
yes but it says undefined function ?
Having the same issue, working from child theme folder, opening settings.php
which has starting and ending php tags, there is no autocomplete and all WP functions are red underlined as i.e.:
Undefined function 'wp_register_style'.intelephense(1010)
Hey there - can you temporarily disable the Intelephense extension and let me know if it's still occurring? It seems to be a conflict with that extension but I'd like to be more certain. Thanks!
FYI the Snippets extension is literally just a bog-standard (albeit large) VS Code snippet file.
Indeed, with Intelephense turned off the issues go away, however Intelephense is a rather common plugin for PHP editing so ideally both should work together. If I ever have the time I could look into Intelephense compatibility, i.e. find out if there is a way to let Intelephense understand the snippits are valid PHP functions.
What's that status of this? The same issue occurs with another common and active PHP extension: PHP by Devsense. Disabling it makes the issues go away, but then a lot of useful php development functionality is gone too.
Hi @emarvegt, you've added a little bit of information and I installed PHP by Devsense extension to see what's going on. I can see that it is underlining WP functions in yellow, and that when you hover over the underline, it says "Call to undefined function". This is because extensions like Intelliphense and PHP by Devsense seem to be looking for those functions to be defined in a PHP file within the project itself.
If you add a folder to your project with WordPress's PHP files - (get them here: https://wordpress.org/latest.zip) can you let me know if this issue goes away?
Hi Jason, thanks for the quick reply. You're right, I wasn't very elaborate. What you are describing is indeed what I was experiencing. Adding the Wordpress files solved the issue indeed!
Hi, I have installed this extension in VScode but nothing changed. It doesn't work. Is there any configuration necessary ?