tliron / glsp

Language Server Protocol SDK for Go
Apache License 2.0
165 stars 22 forks source link

Support textDocument/diagnostic method #30

Closed blacktrub closed 4 months ago

blacktrub commented 4 months ago

Hello! I use your library for my pet project and I needed the textDocument/diagnostic method for my case. Maybe you'll be interested in such changes as well. Things I added:

tliron commented 4 months ago

Many thanks for this!!! The problem we need to solve is that this is LSP 3.17 stuff, and this library has been careful to maintain specific versions in specific directories. I wonder if there's a way to put your code in a new 3_17 directory and for now only copy the new types that are needed so that users could use new 3_17 features with existing 3_16 code, at least until we have a complete 3_17 implementation.

What do you think we can do here? I want to keep your code, just not sure how to do it best.

blacktrub commented 4 months ago

@tliron Hello! I have done what you asked, check it out please. So now the whole protocol 3.17 stuff in a separate directory. In case someone needs it they would need to use protocol317.Handler to use new features. I haven't found a way to do it properly without copypaste, so let me know what you think.

tliron commented 4 months ago

Thanks! Yours is the first shot at 3.17 support, which people have been asking for. For now, copy paste is OK, we'll have to think of how to make it more efficient. Maybe some kind of dynamic factory where you provide the version at runtime.

Small request -- let's rename the 3.17 package to protocol, too, to match what we have with 3.16. My initial design idea was that when you import the package you give it a useful name. So in your code when you import from protocol_3_16 you can name it protocol316 to avoid naming conflicts. Same for protocol317, just when you import it. Does that make sense?

blacktrub commented 4 months ago

Done!

tliron commented 4 months ago

Many thanks for this. :)