Hi, On Thu, Apr 14, 2022 at 10:34 PM Prabir Shrestha <[email protected]> wrote:
> I'm able to download the latest version of vim with lsp support on > Windows. Thanks for the quick fix. ArchLinux vim also seems to be updated > to include this patch. Looking forward to seeing plugin authors use this > feature. > > I have started adding support for native lsp client in vim-lsp > <https://github.com/prabirshrestha/vim-lsp/> and I'm very happy with the > simplicity and ease of use of the api. > > I have just got basic request/response working so this feedback is a bit > limited while playing with the api for several mins. > > 1. LSP support $/cancelRequest > > <https://microsoft.github.io/language-server-protocol/specifications/specification-current/#cancelRequest> > which requires sending the request id. This is heavily used by vim-lsp in > order to cancel previous requests such as completion results that could had > changed, highlighting current keyword that could had changed due to the > cursor movements. Doc explicitly says Note that in the request message > the 'id' field should not be specified. Is it possible to have an api > to either set the id or get the id of the request? > > Patch 8.2.4758 ( https://github.com/vim/vim/commit/3b470ae88f034d3741832ab1cc51a5bb8edaf4c6) added the support for returning the message ID for a request message sent using ch_sendexpr(). The help text is also updated to describe how to use these functions. Let me know if you have any additional comments. Regards, Yegappan > > 1. Is it possible to document what resp is in the example doc. let > resp = ch_evalexpr(ch, req, #{timeout: 100}). I also see this being > used in the test and it checks for empty object. I thought this was the > request id but always seem to be empty during my limited test. Probably > this only makes sense for synchronous request? It would still be good to > document that it will always be empty for async as it created a bit > confusion to me. > 2. Minor: Should the doc include the full raw request? {'jsonrpc': > '2.0', 'id': 1, 'result': { ...}}. I see this as useful doc when > writing remote LSP/Json RPC plugins. > 3. It took be a bit to figure out the callback args for ch_evalexpr > but seems like this is already documented at the end where it says to refer > to |channel-callback|. One thing that wasn't clear is if there is a JSON > RPC Error Message would it still call the callback function? Clarifying > that caller needs to handle the message whether it is success or error rpc > messages would be better here. In the future I can see having > on_success and on_error callbacks. I don't see me using this in > vim-lsp but do see it using in other plugins. > https://www.jsonrpc.org/specification#response_object > 4. Can the sync and async method be used on the same channel? Because > vim doesn't support async BufWritePre we recommend users to use the > following code to auto format on save. While 99% of the code will be using > async function there will be sync methods for writing. > > let g:lsp_format_sync_timeout = 1000autocmd! BufWritePre *.rs,*.go call > execute('LspDocumentFormatSync') > > > 1. Is it possible to document the behavior of how to handle timeouts? > When using let resp = ch_evalexpr(ch, req, #{timeout: 100}) what error > is thrown and what error should I handle? > > > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7m2EwSwS9Q9exePAYtZK%3D9tvheuCcz62Yk%3DwyzshO_t%2Bg%40mail.gmail.com.
