Skip to content

PHP Intelephense extension not working #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HeavyHorst opened this issue Mar 11, 2019 · 18 comments
Closed

PHP Intelephense extension not working #200

HeavyHorst opened this issue Mar 11, 2019 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@HeavyHorst
Copy link

Description

Error: Cannot find module 'vscode-languageserver'
    at Module.r.require.e [as require] (/app/code-server:468:26234)
    at Object.i.__awaiter.n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:155362)
    at n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:113)
    at Object.<anonymous> (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:147092)
    at n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:113)
    at Object.i.__awaiter.n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:146712)
[Error - 18:00:17] Connection to server got closed. Server will not be restarted.

Steps to Reproduce

Install the extension and open a php file.

@sebastianmacias
Copy link

Maybe related: I'm also having the same issue with vetur: https://github.com/vuejs/vetur The extension colors the code but intellisense and auto formatting isn't working.

@foresthoffman
Copy link
Contributor

@HeavyHorst When did you first install the extension?

@foresthoffman foresthoffman self-assigned this Mar 11, 2019
@HeavyHorst
Copy link
Author

@foresthoffman
I first installed the extension on Saturday and then uninstalled it directly because it didn't work.
I reinstalled the extension just before opening this issue.

@foresthoffman
Copy link
Contributor

@HeavyHorst Please try uninstalling again, but this time also manually remove the ~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8 directory. Then, reinstalling should perform a proper redownload.

@HeavyHorst
Copy link
Author

I deleted the complete .code-server folder and restarted the server.
I'm still getting this error message:

Error: Cannot find module 'vscode-languageserver'
    at Module.r.require.e [as require] (/app/code-server:468:26234)
    at Object.i.__awaiter.n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:155362)
    at n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:113)
    at Object.<anonymous> (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:147092)
    at n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:113)
    at Object.i.__awaiter.n (~/.code-server/extensions/bmewburn.vscode-intelephense-client-1.0.8/node_modules/intelephense/lib/intelephense.js:39:146712)
[Error - 19:48:24] Connection to server got closed. Server will not be restarted.

@foresthoffman foresthoffman added bug Something isn't working needs-investigation labels Mar 12, 2019
@RiFi2k
Copy link

RiFi2k commented Mar 13, 2019

I get the same problem with intelephense. For me though felixfbecker.php-intellisense is working perfectly, so I'm taking a stab that it probably has something to do with where their language server packages are required from.

Intelephense is trying to get them from the node_modules folder where as intellisense is getting them successfully from the composer vendor folder.

@RiFi2k
Copy link

RiFi2k commented Mar 13, 2019

Ok now I'm pretty much 95% positive it is the paths that is the issue here. If you go in to the file requiring whatever, for example I was using shinn.stylelint to debug because the code isn't minified.

Originally the error comes from

const {createConnection, Files, ProposedFeatures, TextDocuments} = require('vscode-languageserver');

Then if you change that to an absolute path from your filesystem root, it will find that module and error our on the next relative path require it hits, I went on fixing 4 or 5 levels up of this til I was convinced this is the issue.

Hope it help, great project btw!

@foresthoffman
Copy link
Contributor

Hmm, that's very weird. I appreciate the feedback! intelephense should be working, as it's requiring vscode-languageserver and vscode-languageserver is sitting in node_modules, right next to the source. It just doesn't work for some reason.

@HeavyHorst does felixfbecker.php-intellisense work for you?

@RiFi2k
Copy link

RiFi2k commented Mar 13, 2019

You can see if you look at the extension output inside vscode from any extension trying to require the language server packages from node_modules they all 100% come back as invalid module not found with the relative path. I have 3 extensions all failing because of the same relative path issue, and the only one not using them from inside node_modules is working fine.

Is it possible you have some webpack resolve setting somewhere which is setting the resolvable paths to vscode-languageserver packages to somewhere specific not including where extensions would be loading from?

@RiFi2k
Copy link

RiFi2k commented Mar 15, 2019

Getting super close on this now, if I had to wager I would say this is the problem, likely with alot of stuff.

cb2232.bundle.js:45 [Extension Host] Activating extension `CoenraadS.bracket-pair-colorizer-2` failed:  Cannot find module '/./node_modules.asar/vscode-textmate'
cb2232.bundle.js:45 [Extension Host] Here is the error stack:  Error: Cannot find module '/./node_modules.asar/vscode-textmate'

Looks like when extensions (probably the built in terminal as well), try and resolve modules from node_modules folder webpack wants to resolve their path as an absolute path always.

Maybe I'm mistaken but is this a string replace loader on the filepath with a regex on as .js and .ts files?
Right below is one for all node module files using the node-loader library.

https://github.com/codercom/code-server/blob/master/scripts/webpack.general.config.js#L16

Something of interest possibly right in here https://github.com/codercom/code-server/blob/master/packages/ide/src/fill/path.js#L305 exporting all those function into the global scope.

I know you all will be happy to track this down and close it because no joke the same root issue here probably accounts for ~half your open issues in one way or another.

@Pitu
Copy link

Pitu commented Mar 15, 2019

I was about to make an issue regarding Bracket Pair Colorizer 2 not working as well but after reading the thread and your last post it makes sense that the problem is bigger than just that, and finding the root cause is the way to go. As far as I know, a lot of extensions are being affected by this including Eslint, Bracket Pair, Intelephense and a few others.

@coder coder deleted a comment from BSGILL012 Mar 18, 2019
@foresthoffman
Copy link
Contributor

foresthoffman commented Mar 18, 2019

It appears that the version of CoenraadS.bracket-pair-colorizer-2 that we're currently hosting on our marketplace is outdated. The reason being, the extension cannot be packaged due to a faulty dependency. The extension requires the [email protected] package which was responsible for a major security hole, so it was removed from npm. Although the package.json has been updated to exclude this package, the lock file still refers to it here. This renders the extension unpackageable.

Currently looking into the issue with '/./node_modules.asar/vscode-textmate'.

@RiFi2k
Copy link

RiFi2k commented Mar 20, 2019

I actually used the current version from my regular VSCodium install. Copied to the code-server install.

@foresthoffman
Copy link
Contributor

@HeavyHorst @RiFi2k bmewburn.vscode-intelephense-client-1.0.8 should be good now, on our newest release. PR #284 should fix the CoenraadS.bracket-pair-colorizer-2 extension's error regarding vscode-textmate.

@RiFi2k
Copy link

RiFi2k commented Mar 20, 2019

@foresthoffman My man, nicely done

@HeavyHorst
Copy link
Author

Works like a charm. Thanks!

@NickBolles
Copy link

@sebastianmacias did you ever get your issue with vetur figured out?

@deansheather
Copy link
Member

@NickBolles if you're still having an issue with Vetur, you're better off opening a new issue with the "broken extension" template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants