diff --git a/README.md b/README.md index a654b1d..c24a477 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ The Language Server Protocol provides IDE-like intelligence to Claude Code. On s | [gleam](./gleam) | Gleam | `.gleam` | [gleam](https://gleam.run/) | | [gopls](./gopls) | Go | `.go` | [gopls](https://github.com/golang/tools/tree/master/gopls) | | [intelephense](./intelephense) | PHP | `.php` `.phtml` | [Intelephense](https://github.com/bmewburn/intelephense-docs) | +| [wordpress-intelephense](./wordpress-intelephense) | PHP (WordPress) | `.php` `.phtml` | [Intelephense](https://github.com/bmewburn/intelephense-docs) | | [jdtls](./jdtls) | Java | `.java` | [jdtls](https://github.com/eclipse-jdtls/eclipse.jdt.ls) | | [kotlin-lsp](./kotlin-lsp) | Kotlin | `.kt` `.kts` | [kotlin-lsp](https://github.com/Kotlin/kotlin-lsp) | | [lua-language-server](./lua-language-server) | Lua | `.lua` | [lua-language-server](https://github.com/LuaLS/lua-language-server) | @@ -76,6 +77,7 @@ Install individual plugins: /plugin install gleam@claude-code-lsps /plugin install gopls@claude-code-lsps /plugin install intelephense@claude-code-lsps +/plugin install wordpress-intelephense@claude-code-lsps /plugin install jdtls@claude-code-lsps /plugin install kotlin-lsp@claude-code-lsps /plugin install lua-language-server@claude-code-lsps @@ -292,6 +294,17 @@ npm install -g intelephense +
+PHP / WordPress (wordpress-intelephense) + +Same LSP as `intelephense` but with WordPress stubs enabled. Install this **instead of** `intelephense` for WordPress projects. + +```bash +npm install -g intelephense +``` + +
+
Python (pyright) diff --git a/wordpress-intelephense/.claude-plugin/plugin.json b/wordpress-intelephense/.claude-plugin/plugin.json new file mode 100644 index 0000000..24e714b --- /dev/null +++ b/wordpress-intelephense/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "wordpress-intelephense", + "description": "PHP language server with WordPress stubs", + "version": "1.0.0", + "author": { + "name": "IgnitionWP" + }, + "license": "MIT", + "repository": "https://github.com/boostvolt/claude-code-lsps", + "homepage": "https://github.com/boostvolt/claude-code-lsps" +} diff --git a/wordpress-intelephense/.lsp.json b/wordpress-intelephense/.lsp.json new file mode 100644 index 0000000..666bd01 --- /dev/null +++ b/wordpress-intelephense/.lsp.json @@ -0,0 +1,84 @@ +{ + "php": { + "command": "intelephense", + "args": ["--stdio"], + "extensionToLanguage": { + ".php": "php", + ".phtml": "php" + }, + "settings": { + "intelephense.stubs": [ + "apache", + "bcmath", + "bz2", + "calendar", + "com_dotnet", + "Core", + "ctype", + "curl", + "date", + "dba", + "dom", + "enchant", + "exif", + "FFI", + "fileinfo", + "filter", + "fpm", + "ftp", + "gd", + "gettext", + "gmp", + "hash", + "iconv", + "imap", + "intl", + "json", + "ldap", + "libxml", + "mbstring", + "meta", + "mysqli", + "oci8", + "odbc", + "openssl", + "pcntl", + "pcre", + "PDO", + "pgsql", + "Phar", + "posix", + "pspell", + "random", + "readline", + "Reflection", + "session", + "shmop", + "SimpleXML", + "snmp", + "soap", + "sockets", + "sodium", + "SPL", + "sqlite3", + "standard", + "superglobals", + "sysvmsg", + "sysvsem", + "sysvshm", + "tidy", + "tokenizer", + "uri", + "xml", + "xmlreader", + "xmlrpc", + "xmlwriter", + "xsl", + "Zend OPcache", + "zip", + "zlib", + "wordpress" + ] + } + } +} diff --git a/wordpress-intelephense/README.md b/wordpress-intelephense/README.md new file mode 100644 index 0000000..49c310a --- /dev/null +++ b/wordpress-intelephense/README.md @@ -0,0 +1,32 @@ +# wordpress-intelephense + +PHP language server ([Intelephense](https://intelephense.com/)) for Claude Code with WordPress stubs enabled. + +## Why? + +The base `intelephense` plugin doesn't include WordPress stubs, so Intelephense reports false positives for WordPress core functions like `add_action`, `get_post`, `wp_nonce_field`, etc. + +This plugin adds `"wordpress"` to Intelephense's built-in stubs list alongside all the default PHP stubs, giving you accurate diagnostics in WordPress projects. + +## Usage + +Install this plugin **instead of** the base `intelephense` plugin — not alongside it. + +## Supported Extensions + +`.php`, `.phtml` + +## Installation + +Install Intelephense globally via npm: + +```bash +npm install -g intelephense +``` + +The plugin will attempt to install Intelephense automatically on first session start if it's not found. + +## More Information + +- [Intelephense Website](https://intelephense.com/) +- [Intelephense on npm](https://www.npmjs.com/package/intelephense) diff --git a/wordpress-intelephense/hooks/check-intelephense.sh b/wordpress-intelephense/hooks/check-intelephense.sh new file mode 100755 index 0000000..0aba40e --- /dev/null +++ b/wordpress-intelephense/hooks/check-intelephense.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Check if intelephense is installed and available in PATH + +if command -v intelephense &> /dev/null; then + exit 0 +fi + +# Check if npm is available +if command -v npm &> /dev/null; then + echo "[wordpress-intelephense] Installing intelephense via npm..." + npm install -g intelephense + + if command -v intelephense &> /dev/null; then + echo "[wordpress-intelephense] Installed successfully" + exit 0 + fi +fi + +# Manual instructions +echo "[wordpress-intelephense] intelephense is not installed." +echo " Install: npm install -g intelephense" + +exit 0 diff --git a/wordpress-intelephense/hooks/hooks.json b/wordpress-intelephense/hooks/hooks.json new file mode 100644 index 0000000..f3162bb --- /dev/null +++ b/wordpress-intelephense/hooks/hooks.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/check-intelephense.sh", + "timeout": 60 + } + ] + } + ] + } +}