TysonAndre / vscode-php-phan

Phan - PHP Static Analysis for VS Code
Other
24 stars 4 forks source link

How to debug the language server not starting #73

Closed slifin closed 4 years ago

slifin commented 4 years ago

I'm helping a co-worker setup phan in their vscode editor, I can get the extension working on my machine but on his machine it sits on: starting PHP Phan language server

where as mine will go:

[Extension Host] starting PHP Phan language server
console.ts:137 [Extension Host] starting Phan Language Server /usr/local/bin/php Array(12)
console.ts:137 [Extension Host] [vscode-icons] v9.7.0 activated!
console.ts:137 [Extension Host] PHP process connected

and work, we have tried uninstalling his other extensions and have compared out settings.json, his phan installation also works outside of vscode, how can I debug the starting of the language server?

TysonAndre commented 4 years ago

What OS and php version is your coworker using?

Does Phan emit the line starting Phan Language Server /usr/local/bin/php Array(...) ?

Do any popups warning about invalid Phan settings show up when they open VS Code (they should show up in the bottom right)? Right now, Phan has various checks that create popups, but don't call console.log - see https://github.com/TysonAndre/vscode-php-phan/blob/master/src/extension.ts

You could try manually adding console.log statements to see what line vscode-php-phan stops at : The path should be ~/.vscode/extensions/tysonandre.php-phan-1.2.1/out/extension.js

E.g. for cases like this, there would be a pop-up, but nothing in console.log.

    if (semver.lt(astVersion, '1.0.1')) {
        vscode.window.showErrorMessage('Phan 2.x needs at least ext-ast 1.0.1 installed. Version found: ' + astVersion + ' PHP Path: ' + phpExecutablePath);
        return false;
    }
    return true;
TysonAndre commented 4 years ago

The other possibility is that the language server isn't starting because the folder they currently have open doesn't have any files with the lowercase extension .php (see phan.analyzedProjectDirectory and phan.analyzedFileExtensions.

It's currently configured to only start the language server when opening folders with php files, and that language server will only work for analyzedProjectDirectory

slifin commented 4 years ago

Thank you, will take a look when I have the next opportunity and update here if I find anything