diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-04-02 18:30:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-04-02 18:30:13 +0800 |
commit | e5947d5cb525d0c3376d36be657c0f940d8bfaf8 (patch) | |
tree | 7457fbc168b3f0598038fe299b57c4e98b8400e9 /script/provider/semantic-tokens.lua | |
parent | 55e7d5950398eb6816646d1612701565364fa08b (diff) | |
download | lua-language-server-e5947d5cb525d0c3376d36be657c0f940d8bfaf8.zip |
fix #482
Diffstat (limited to 'script/provider/semantic-tokens.lua')
-rw-r--r-- | script/provider/semantic-tokens.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/script/provider/semantic-tokens.lua b/script/provider/semantic-tokens.lua index bc8f81b9..268b8648 100644 --- a/script/provider/semantic-tokens.lua +++ b/script/provider/semantic-tokens.lua @@ -4,6 +4,7 @@ local client = require 'provider.client' local json = require "json" local config = require 'config' local lang = require 'language' +local nonil = require 'without-check-nil' local isEnable = false @@ -23,9 +24,11 @@ local function enable() if isEnable then return end - if not client.info.capabilities.textDocument.semanticTokens then + nonil.enable() + if not client.info.capabilities.textDocument.semanticTokens.dynamicRegistration then return end + nonil.disable() isEnable = true log.debug('Enable semantic tokens.') proto.awaitRequest('client/registerCapability', { @@ -80,6 +83,11 @@ local function disable() if not isEnable then return end + nonil.enable() + if not client.info.capabilities.textDocument.semanticTokens.dynamicRegistration then + return + end + nonil.disable() isEnable = false log.debug('Disable semantic tokens.') proto.awaitRequest('client/unregisterCapability', { |