Describe the bug
For some reason using the following config I can't seem to get custom file extensions to be indexed:
{
"files.associations": {
"*.inc": "php",
"*.php": "php"
}
}
To Reproduce
Expected behavior
Setting the files.associations array should allow the indexing of non-standard file extensions.
Not sure how to debug
I have been trying to resolve this issue for a couple of days now. But I'm not sure how to validate which files have been indexed. The only way I can see that they were not indexed is after I open an .inc file it will be indexed.
Platform and version
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
"vscode-intelephense": "1.4.1"
No @jfcherng , the files.associations will be merged with intelephense.files.associations:
@verbruggenalex are you using short tags?
@bmewburn no. Only full php opening tags (Drupal development .inc, .module, files...)
For me it seems that neither files.associations and intelephense.files.associations settings have any effect on the indexing command process. Whenever I change intelephense.files.associations to only have ".inc" it still only indexes ".php" files for me.
But when opening files in Theia it does seem to index the individual "*.inc" files that are opened.
I'll see if I can make you a light docker image that you can check out to reproduce the issue.
If you want to have a look @bmewburn :
git clone [email protected]:verbruggenalex/theia-php-intelephense-indexing.git
cd theia-php-intelephense-indexing
docker-compose up -d
Hi @bmewburn,
I'm not really familiar with writing vscode plugins yet. But to me it seems that intelephense is not passing any pattern to the documentSelector within the clientOptions for the LanguageClient:
https://github.com/bmewburn/vscode-intelephense/blob/32f027ecc734001e9402ed82b0ac833d71deb6fc/src/extension.ts#L153-L155
DocumentFilter API: https://code.visualstudio.com/api/references/vscode-api#DocumentFilter
But I think that adding a pattern without language or scheme is required to have the custom exension files indexed. And this could possibly register non php files that have a custom file extension as a php file.
Anywayz, this looks like a known issue also
I hope we can find a solution for this as it is blocking intelephense usage for a lot of frameworks that rely on non standard file extension names.
@verbruggenalex is the issue just related to theia? In vscode adding *.inc to files.associations works fine for me. Could your issue be the same as this https://github.com/eclipse-theia/theia/issues/5945 ? There seems to be something about the middleware layer that theia doesnt like https://github.com/bmewburn/vscode-intelephense/blob/master/src/middleware.ts
Sorry to bother you again @bmewburn . But do you have any good resource on how I can compile the code in this repository? Running yarn seems to compile intelephense.js but not extension.js.
@verbruggenalex npm install && npm run production will build it. Then you can run a debug session in vscode (maybe theia too?) with the Launch Extension debug task. To build a vsix - vsce package.
Thanks @bmewburn. I was able to successfully build the extension. But when trying to run it in the docker Theia instance the extension fails to activate.
Activating extension PHP Intelephense failed: The language client requires VS Code version ^1.42.0 but received version 1.2.0.
I'm not really sure why Theia is using its own package for running vscode extensions. But it may be why it doesn't run exactly the same on Theia.
I'm afraid my knowledge in NPM is not sufficient to try and help on this issue. So I'm going to put this on hold for myself. I hope someone can pick this issue up. Solving it will enable full usage of Intelephense for popular services like GitPod or custom docker build images based on Theia:
I'm closing this issue because with the latest version of Intelephense (v1.5.4) I'm not experiencing the problem any longer.
Thank you for the support @bmewburn. I will be enjoying your plugin a lot! If anyone is interested in the Docker image I created for developing PHP applications you can find it here: https://github.com/verbruggenalex/docker-theia-php
I'm deleting the other repository that was used for debugging this issue.