Skip to content

PHP Intelephense extension not working #200

Closed

Description

@HeavyHorst

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.

Activity

  1. sebastianmacias commented on Mar 11, 2019

    @sebastianmacias

    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.

  2. foresthoffman commented on Mar 11, 2019

    @foresthoffman
    Contributor

    @HeavyHorst When did you first install the extension?

  3. HeavyHorst commented on Mar 11, 2019

    @HeavyHorst
    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.

  4. foresthoffman commented on Mar 11, 2019

    @foresthoffman
    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.

  5. HeavyHorst commented on Mar 11, 2019

    @HeavyHorst
    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.
    
  6. RiFi2k commented on Mar 13, 2019

    @RiFi2k

    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.

  7. RiFi2k commented on Mar 13, 2019

    @RiFi2k

    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!

  8. foresthoffman commented on Mar 13, 2019

    @foresthoffman
    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?

  9. RiFi2k commented on Mar 13, 2019

    @RiFi2k

    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?

  10. RiFi2k commented on Mar 15, 2019

    @RiFi2k

    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.

  11. Pitu commented on Mar 15, 2019

    @Pitu

    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.

  12. deleted a comment from BSGILL012 on Mar 18, 2019
  13. foresthoffman commented on Mar 18, 2019

    @foresthoffman
    Contributor

    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 event-stream@3.3.6 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'.

  14. RiFi2k commented on Mar 20, 2019

    @RiFi2k

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

  15. foresthoffman commented on Mar 20, 2019

    @foresthoffman
    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.

  16. RiFi2k commented on Mar 20, 2019

    @RiFi2k

    @foresthoffman My man, nicely done

  17. HeavyHorst commented on Mar 22, 2019

    @HeavyHorst
    Author

    Works like a charm. Thanks!

  18. NickBolles commented on Jun 26, 2019

    @NickBolles

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

  19. deansheather commented on Jun 27, 2019

    @deansheather
    Collaborator

    @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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions