danr / kakoune-languageclient

WIP: Language server protocol client for the Kakoune text editor
MIT License
9 stars 0 forks source link

Support textEdits #6

Open danr opened 6 years ago

danr commented 6 years ago

< mawww> btw, kakoune-languageclient completion should use the position returned by the completion engine, not the one at which kakoune triggered the completion < mawww> In my tests, if I type 'import java.blah.' I get various completion candidates named 'java.blah....' but if I select one I get 'java.blah.java.blah....'

< danr> mawww: uff. there was a long issue about insertText on the lsp tracker regarding what text to insert and what to do when there are multiple cursors: https://github.com/Microsoft/language-server-protocol/issues/264 < danr> what is the name of the language server you're using?

< mawww> eclipse.jdt.ls I think

< danr> but regarding what you propsed isn't a "position returned by the completion engine". If insertText is used, there is no such position at all, and if TextEdits are used then anything could happen :(

< danr> it seems like that server's insertText is 'java.blah.foo' instead of 'foo' in this case, so you get an extra copy of 'java.blah'. I have not seen that in any other server

< danr> I'll jot it down in an issue so I don't forget

< mawww> danr: in insertText you have a range, right < mawww> this range gives you the position at which the completion should take place

< danr> no, insertText is just a string: https://microsoft.github.io/language-server-protocol/specification#textDocument_completion

< mawww> danr, dont you get the textEdit field ? its the recommended one to use

< danr> mawww: I haven't used the textEdits so far, my worry is that they might not have the same starting coordinate

< mawww> Yeah, that would be pretty hard to handle

< danr> then it would be difficult to make it fit into the kakoune completion mechanism

Related: #2