Re: [code] [textadept] New Language Server Protocol client module

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Sun, 30 Sep 2018 23:02:48 +0100

Hi Mitchell,

On Sun, Sep 30, 2018 at 09:29:25PM +0100, Chris Emerson wrote:
> On Mon, Sep 17, 2018 at 09:27:16PM -0400, Mitchell wrote:
> The attached rough patch (against b5beae87e409, or at least that's the name
> of the ZIP file I got from hg) gets through that, though might not do it
> the best way. The changes are:
>
> 1. The 'initialized' message seems to need an empty object rather than
> nothing. Otherwise the RLS returns an error.
> 2. The lines come back with \r\n line endings, and the lines end up with
> '\r' at the end and don't match the "Content-Length" pattern, plus
> `#line > 0` is always true.
>
> I haven't yet worked out how to get information out of it, but at least
> it doesn't hang on opening a Rust file now. :-) I use
> `_M.lsp.server_commands.rust = 'rls'` after installing it.

I've had a further look. It's partly working - occasionally I get some
diagnostics showing as annotations, which is excellent! I've also successfully
used the "jump to definition" and similar commands.

I think I'm hitting a couple of issues which means it's not yet reliable:

* If Server:handle_stdout gets more than one message, then it was losing the
next one, because the recursive call was eating the 'C' of 'Content-Length'
from the next message. I "fixed" that by removing the "+ 1"; I'm not sure
if that's right, or whether it's just cancelling out a bug in my previous
patch where I just remove '\r' characters.

* I've seen notifications from the server being split across reads (e.g.
the "Content-Length: 1234\r\n\r\n" in one read, and the actual message in
the next). I can see that's not handled yet.

Thanks again for this module (and Textadept generally)!

Chris

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 30 Sep 2018 - 18:02:48 EDT

This archive was generated by hypermail 2.2.0 : Mon 01 Oct 2018 - 06:31:56 EDT