-
Notifications
You must be signed in to change notification settings - Fork 256
Sharing the language-server-protocol types #52
Comments
If anything, it would be super nice to have a common repository for these types - I'm sure there are other folks who might be interested in building their own languages in Rust who might be able to benefit. |
Yeah it would be good to integrate this work. I'd be willing to use such crate in RustLSP, but there is one obstacle: I want the source to work with Racer (and other tools), which means Serde source generation has to occur into See for example: https://github.com/RustDT/RustLSP/blob/master/build.rs , (I think this might complicate the dual approach of also using |
Looks like there is an (old) issue open for handling |
Yeah, it would be good to pull out the LSP crates. @bruno-medeiros why use Serde source generation at all? Much better to use Serde derive which the compiler understands. |
@nrc Until macros 1.1 are stable using source generation is still necessary to support stable rust. That's about the only reason though. |
@Marwes macros 1.1 are in FCP and are likely to be stabilised soon. Certainly well before the RLS moves off the nightly compiler. Given the inherent instability of Serde or other code gen even on stable compiler, I'd rather be on nightly for a few months with a good solution, than be stuck with a crappy solution. |
I guess that is fair. I do appreciate being able to build on stable but its hardly a deal breaker not to. Then again the cost of allowing for both modes is low as well. |
If macros 1.1 are going to be stabilized soon, I'm fine with using the nightly compiler. I'd also be okay with the dual approach - again if at least one of the modes can be made to work with Racer (this means not using But out of curiosity:
why is serde_codegen a crappy solution? What is the inherent instability of Serde? |
Serde is fine, but having to do codegen outside the compiler is not - you lose the benefit of decent error message, and it breaks a lot of tools support (including the RLS, and even Racer, it sounds like). |
@Marwes I was looking into this, it seems the dual approach can't be done and yet have it work with Racer, since the dual approach must use |
@Marwes I would also want to merge in some changes from https://github.com/RustDT/RustLSP/blob/master/src/lsp.IN.rs - your VScode type seem more complete, but there is a few things I'd like to add. |
Extracted the crate into https://github.com/gluon-lang/languageserver-types. If anyone wants merge access, give me a ping. |
Nice, yeah I am sure there are some stuff that aren't quite correct since there are parts aren't used yet and there are, as mentioned, some inconsistencies with nullable fields. |
@Marwes I sent a PR your way: gluon-lang/lsp-types#1. (I'd also accept a merge access). Check the full commit message for details. In short it updated to latest LSP protocol version, but also fixed some issues. For example you can't use With this PR, RustLSP will be able to use the languageserver-types crate instead. |
@nrc You interested in a PR to make rustls use https://github.com/gluon-lang/languageserver-types? I can have a go at that. |
@bruno-medeiros yeah, definitely. It might take some iteration to make it fit in, but I'm keen to have a more principled use of the LS protocol. |
Yeah I just realized that this a few days ago when starting to implement visual codes debugserver protocol. As an alternative to using |
Yes, it would be possible to use Also, we can always add a getter associated method to the LSP type that returns an empty vector if it's a None. That should mitigate the issue, no? |
Figured that if one actually treats empty array and a missing field differently then that should be considered a bug in any case. If for some weird reason the correct behavior is to treat them differently then we could always change it to an Don't want to bikeshed any further so if you still prefer the |
I agree that a missing property should semantically be treated the same as a property with null value (in fact that's why I opened this: microsoft/language-server-protocol#87). But that is different from what I was talking above. I was talking about the difference between a null (or missing) list field vs. an empty list.
Okay, let's go with Option then, thanks. |
Meant the difference between a missing field and the empty list but I mistyped. |
Note that a case of DidChangeTextDocumentParams need handling. Closes rust-lang#52
Note that a case of DidChangeTextDocumentParams need handling. Closes rust-lang#52
In conjunction to releasing a new version of https://github.com/gluon-lang/gluon_language-server I was planning to also release a crate containing only the types used to communicate in the language-server-protocol https://github.com/Marwes/gluon_language-server/tree/source_map/vscode-languageserver-types.
I believe that at least for just these types there is little reason for duplicating the implementation effort (especially since there seems to be some inconsistencies in the protocol microsoft/language-server-protocol#87). Is there any interest in using that crate (or a crate like it) here as well? I'd be happy to move it to a separate repository as well if that seems easier to work with.
cc @bruno-medeiros
Related #35
The text was updated successfully, but these errors were encountered: