vscode-phpactor icon indicating copy to clipboard operation
vscode-phpactor copied to clipboard

Can I somehow use this in the monaco editor?

Open justlunix opened this issue 2 years ago • 3 comments

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

justlunix avatar Aug 31 '23 19:08 justlunix

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

dantleech avatar Aug 31 '23 22:08 dantleech

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.

justlunix avatar Sep 04 '23 07:09 justlunix

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"?

dantleech avatar Sep 04 '23 07:09 dantleech