Last active
August 31, 2018 15:44
-
-
Save Ciantic/07f14ed0247ec3cd92457099cb26e0fe to your computer and use it in GitHub Desktop.
Fixing a PHP Language Server for my own taste
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ciantic/wp", | |
"authors": [ | |
{ | |
"name": "Ciantic", | |
"email": "[email protected]" | |
} | |
], | |
"require": { | |
"wp/WordPress": "^4.9", | |
"wp-plugins/advanced-custom-fields-pro": "^5.0", | |
"wp-plugins/woocommerce": "^5.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"packages": [ | |
{ | |
"name": "wp/WordPress", | |
"version": "4.9.4" | |
}, | |
{ | |
"name": "wp-plugins/advanced-custom-fields-pro", | |
"version": "5.6.8" | |
}, | |
{ | |
"name": "wp-plugins/woocommerce", | |
"version": "3.3.3" | |
} | |
], | |
"packages-dev": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Will read and parse the passed source files in the project and add them to the appropiate indexes | |
* | |
* @return Promise <void> | |
*/ | |
public function index(): Promise | |
{ | |
return coroutine(function () { | |
$pattern = Path::makeAbsolute('**/*.php', $this->rootPath); | |
$uris = yield $this->filesFinder->find($pattern); | |
// CIANTIC Fixes things for good | |
if (preg_match("#wp-content[\\\\/]themes#", $this->rootPath)) { | |
$this->client->window->logMessage(MessageType::INFO, "My WordPress themes should have stuff from here!"); | |
$this->composerLock = json_decode(file_get_contents("file:///C:/DepSource/WP/composer.lock")); | |
$this->composerJson = json_decode(file_get_contents("file:///C:/DepSource/WP/composer.json")); | |
// $this->client->window->logMessage(MessageType::INFO, "test" . var_export($this->composerLock, true) . var_export($this->composerJson, true)); | |
$uris = array_merge($uris, yield $this->filesFinder->find('C:/DepSource/WP/**/*.php')); | |
} | |
$count = count($uris); | |
$startTime = microtime(true); | |
$this->client->window->logMessage(MessageType::INFO, "$count files total"); | |
/** @var string[] */ | |
$source = []; | |
/** @var string[][] */ | |
$deps = []; |
- Create folder "C:/DepSource/WP"
- Store the composer.json and composer.lock there
- Download WordPress to "C:/DepSource/WP/vendor/wp/"
- Open
\felixfbecker.php-intellisense-2.3.4\vendor\felixfbecker\language-server\src\Indexer.php
add the changes above
Note This does extra check there: if (preg_match("#wp-content[\\\\/]themes#", $this->rootPath)) {
if your themes are not in path wp-content/themes
you have to change that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also remember to change
PHPDocumentLoader.php
line$limit = 15...
to something greater.