From 4f8d98e583beb4c1abd5d57b9898548396633030 Mon Sep 17 00:00:00 2001 From: Rasmus Ishøy Michelsen <42123601+RMichelsen@users.noreply.github.com> Date: Tue, 22 Sep 2020 21:54:34 +0200 Subject: lsp: Handle ContentModified the same way as RequestCancelled (#12803) * Added the ContentModified error to be hidden from users, like RequestCancelled * Fixed tests (and ill-formed lua code) * Simplified if-expression --- runtime/lua/vim/lsp/rpc.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 64080cf4f2..749a51fecc 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -494,10 +494,13 @@ local function start(cmd, cmd_args, handlers, extra_spawn_params) decoded.error = convert_NIL(decoded.error) decoded.result = convert_NIL(decoded.result) - -- Do not surface RequestCancelled to users, it is RPC-internal. - if decoded.error - and decoded.error.code == protocol.ErrorCodes.RequestCancelled then - local _ = log.debug() and log.debug("Received cancellation ack", decoded) + -- Do not surface RequestCancelled or ContentModified to users, it is RPC-internal. + if decoded.error then + if decoded.error.code == protocol.ErrorCodes.RequestCancelled then + local _ = log.debug() and log.debug("Received cancellation ack", decoded) + elseif decoded.error.code == protocol.ErrorCodes.ContentModified then + local _ = log.debug() and log.debug("Received content modified ack", decoded) + end local result_id = tonumber(decoded.id) -- Clear any callback since this is cancelled now. -- This is safe to do assuming that these conditions hold: -- cgit