Struggling with LSP extension - Socket transport type

Hi everyone !

I am currently working on an integration of Godot and GDscript into Nova. I previously worked on SublimeText, but the quality of Nova made me want to switch.

I have already developed the LanguageDefinition extension for GDScript (which I will release once I have signed the dylib) and am currently developing (and struggling with) the Language Server Protocol part.

The configuration seemed simple to me (just a connection to a local TCP port), but I’m having trouble getting it to work.

The LSP configuration on the Godot side just consists of entering a remote host address (127.0.0.1) and a remote port (6005).

On the Nova Extension side, as the official documentation (LanguageClient) indicates, I assigned the value “socket” to the ‘type’ argument of the ServerOptions and added “–socket=6005” to ‘args’. But this doesn’t seem to work, and the error returned in the extension console is not very informative :

Error: The operation couldn’t be completed. (Nova.LanguageClient.LanguageClientError error 0.)

For information, I also tried to enter the port information as follows, without success:
–socket 6005
–port=6005
–port 6005

Here are the parts of my code in question:

// Create the client
        var serverOptions = {
            args: ["--socket=6005"],
            path: "notUsed",
            type: "socket"
        };
        var clientOptions = {
            // The set of document syntaxes for which the server is valid
            syntaxes: ['gdscript'],
            debug: true
        };
        var client = new LanguageClient('godot', 'Godot Language Server', serverOptions, clientOptions);

        try {
            // Start the client
            client.start();

            // Add the client to the subscriptions to be cleaned up
            nova.subscriptions.add(client);
            this.languageClient = client;
        }
        catch (err) {
            // If the .start() method throws, it's likely because the path to the language server is invalid

            if (nova.inDevMode()) {
                console.error(err);
            }
        }

Can you help me answer these questions:

  • Do we agree that in my case I don’t need a server executable and the ‘path’ argument of the ServerOption is not useful to me ?
  • If this is indeed not a problem, do you know how to properly configure the TCP port to connect to Godot ?

Thank you very much in advance and have a good weekend !

Hello again everyone,

I’m posting this follow-up message to share with you my wanderings trying to get my LSP extension for Godot to work with a TCP/IP connection.

Unfortunately, nothing conclusive at the moment, I tried to add the localhost information (127.0.0.1) with the port information, without success.

After some research, I really wonder if this information should be transmitted via the “args” argument of serverOptions which seems to be used more in cases of stdio calling with the executable server.

But I really don’t see where to enter the port information, especially since the official documentation on the LanguageClient is really very strange when it mentions the socket connection part:

When the socket transport type is specified, the subprocess will receive a launch argument --socket whose value is a port on which the client will attempt to connect on the TCP/IP nameserver. The server is responsible for opening a communication channel to listen for connections on this port.

I don’t understand the “the subprocess will receive a launch argument --socket”.
How do I assign a value to it?

I feel like I’ve started to exhaust all the avenues that the documentation and experimentation allowed me to have… :pensive: