From ab42ffc5c68d3914e72c2e53d81d5909ccb7f868 Mon Sep 17 00:00:00 2001 From: ray-x Date: Sun, 26 Mar 2023 02:45:00 +1100 Subject: [PATCH] issue #266 Error when opening Go files --- lua/navigator/lspclient/clients_default.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lua/navigator/lspclient/clients_default.lua b/lua/navigator/lspclient/clients_default.lua index adebc9e..054c93c 100644 --- a/lua/navigator/lspclient/clients_default.lua +++ b/lua/navigator/lspclient/clients_default.lua @@ -92,11 +92,16 @@ M.defaults = function() and not client.server_capabilities.semanticTokensProvider then local semantic = client.config.capabilities.textDocument.semanticTokens - client.server_capabilities.semanticTokensProvider = { - full = true, - legend = { tokenModifiers = semantic.tokenModifiers, tokenTypes = semantic.tokenTypes }, - range = true, - } + if semantic then + client.server_capabilities.semanticTokensProvider = { + full = true, + legend = { + tokenModifiers = semantic.tokenModifiers, + tokenTypes = semantic.tokenTypes, + }, + range = true, + } + end end end, root_dir = function(fname)