From b751d16cadfc3d2c7e7958432956859b3e2482fa Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Thu, 11 Jun 2020 21:47:03 +0200 Subject: lsp: Fix #12449 textDocumentSync.save can be boolean. Access textDocumentSync.save.includeText only if table. (#12450) --- runtime/lua/vim/lsp/protocol.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 64911fe7bb..4fded1961d 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -897,7 +897,8 @@ function protocol.resolve_capabilities(server_capabilities) text_document_will_save = ifnil(textDocumentSync.willSave, false); text_document_will_save_wait_until = ifnil(textDocumentSync.willSaveWaitUntil, false); text_document_save = ifnil(textDocumentSync.save, false); - text_document_save_include_text = ifnil(textDocumentSync.save and textDocumentSync.save.includeText, false); + text_document_save_include_text = ifnil(type(textDocumentSync.save) == 'table' + and textDocumentSync.save.includeText, false); } else return nil, string.format("Invalid type for textDocumentSync: %q", type(textDocumentSync)) -- cgit