phpactor / vscode-phpactor

Phpactor VS Code Extension
MIT License
120 stars 8 forks source link

Can I somehow use this in the monaco editor? #56

Open justlunix opened 1 year ago

justlunix commented 1 year ago

I am trying to implement the phpactor lsp in the monaco editor, yet I cannot get it to work. When using phpactor on 127.0.0.1:8000 and then using monaco-languageclient to connect to is, all I'm getting is Warning: Undefined array key 1 in phar:///Users/marc/.local/bin/phpactor/vendor/phpactor/language-server/lib/Core/Server/Parser/LspMessageReader.php on line 114.

Do I need to setup a proxy that connects between the monaco-languageclient and phpactor (since I want phpactor to run in STDIO anyway)?

Thanks

dantleech commented 1 year ago

You can use stdio (there's an option for it)

justlunix commented 1 year ago

I know I can use phpactor in stdio, but I don't get how to use it with https://github.com/TypeFox/monaco-languageclient then. I only see examples here where I have to pass an address and port.

dantleech commented 1 year ago

ok, it's a "web" editor so I (guess) that makes sense. it seems the headers in the RPC request are malformed as the offending line is:

    private function parseHeaders(string $rawHeaders): array
    {
        $lines = explode("\r\n", $rawHeaders);
        $headers = [];

        foreach ($lines as $line) {
            [ $name, $value ] = array_map(function ($value) {
                return trim($value);
            }, explode(':', $line));
            $headers[$name] = $value;
        }

        return $headers;
    }

Do you have any raw LSP logs from the "client"?