summaryrefslogtreecommitdiff
path: root/script/capability
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-03-02 13:16:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-03-02 13:16:57 +0800
commitc76c287ae0944080c9671a3d87697f8ea6a25caa (patch)
tree31d170c7cdad77cabcd6e180b0fa4425c0d3df72 /script/capability
parent841e81a182f4de4a062aca30a664cca9b2c4e380 (diff)
downloadlua-language-server-c76c287ae0944080c9671a3d87697f8ea6a25caa.zip
暂存
Diffstat (limited to 'script/capability')
-rw-r--r--script/capability/init.lua1
-rw-r--r--script/capability/semantic.lua40
2 files changed, 41 insertions, 0 deletions
diff --git a/script/capability/init.lua b/script/capability/init.lua
index 09eb6a09..2cc9e70b 100644
--- a/script/capability/init.lua
+++ b/script/capability/init.lua
@@ -1,3 +1,4 @@
return {
completion = require 'capability.completion',
+ semantic = require 'capability.semantic',
}
diff --git a/script/capability/semantic.lua b/script/capability/semantic.lua
new file mode 100644
index 00000000..a5c8746b
--- /dev/null
+++ b/script/capability/semantic.lua
@@ -0,0 +1,40 @@
+local rpc = require 'rpc'
+
+local isEnable = false
+
+local function enable()
+ if isEnable then
+ return
+ end
+ isEnable = true
+ log.debug('Enable semantic.')
+ rpc:request('client/registerCapability', {
+ registrations = {
+ {
+ id = 'semantic',
+ method = 'textDocument/semanticTokens',
+ },
+ }
+ })
+end
+
+local function disable()
+ if not isEnable then
+ return
+ end
+ isEnable = false
+ log.debug('Disable semantic.')
+ rpc:request('client/unregisterCapability', {
+ unregisterations = {
+ {
+ id = 'semantic',
+ method = 'textDocument/semanticTokens',
+ },
+ }
+ })
+end
+
+return {
+ enable = enable,
+ disable = disable,
+}