eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.
https://eclipse.org/lsp4j
Other
609 stars 144 forks source link

Websocket and binary messages? #746

Closed javaduke closed 1 year ago

javaduke commented 1 year ago

I ran into an issue when trying to connect my vscode extension to the remote LSP4J server via websockets. Apparently VScode sends all messages as BINARY and lsp4j does not handle them properly. I found the existing issue #604 and it is closed without any comments. I'm wondering if there's any sort of configuration or additional steps I need to take when implementing the server. Here's the relevant portion of my code:

public void launch(String[] args) throws Exception {
        int _port = getPort(args);

        Server server = new Server(_port);
        ServerConnector connector = new ServerConnector(server);
        server.addConnector(connector);

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        server.setHandler(context);

        JavaxWebSocketServletContainerInitializer.configure(context, (servletContext, wsContainer) ->
        {
            // Configure default max size
            wsContainer.setDefaultMaxTextMessageBufferSize(65535);
            wsContainer.setDefaultMaxBinaryMessageBufferSize(65535);
            // Add websockets
            wsContainer.addEndpoint(MyWSEndpoint.class);

        });

        server.start();
        server.join();
    }
javaduke commented 1 year ago

NM, looks like my issue is https://github.com/eclipse-lsp4j/lsp4j/issues/406