summaryrefslogtreecommitdiff
path: root/script-beta/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-15 21:14:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-15 21:14:01 +0800
commitfcbd709d4d680dab952f19275d23a78160e2d619 (patch)
tree93be1bdc49a920645bdd4d0c55242593f02c4542 /script-beta/provider
parent2dfcd22e91e12515e0bba146de4cb57e539d7d25 (diff)
downloadlua-language-server-fcbd709d4d680dab952f19275d23a78160e2d619.zip
更新
Diffstat (limited to 'script-beta/provider')
-rw-r--r--script-beta/provider/capability.lua6
-rw-r--r--script-beta/provider/provider.lua18
2 files changed, 21 insertions, 3 deletions
diff --git a/script-beta/provider/capability.lua b/script-beta/provider/capability.lua
index aa95c758..29261b77 100644
--- a/script-beta/provider/capability.lua
+++ b/script-beta/provider/capability.lua
@@ -18,9 +18,9 @@ m.initer = {
--documentSymbolProvider = true,
documentHighlightProvider = true,
--codeActionProvider = true,
- --signatureHelpProvider = {
- -- triggerCharacters = { '(', ',' },
- --},
+ signatureHelpProvider = {
+ triggerCharacters = { '(', ',' },
+ },
--workspace = {
-- workspaceFolders = {
-- supported = true,
diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua
index 1360fe12..370da08a 100644
--- a/script-beta/provider/provider.lua
+++ b/script-beta/provider/provider.lua
@@ -387,3 +387,21 @@ proto.on('completionItem/resolve', function (item)
}
return item
end)
+
+proto.on('textDocument/signatureHelp', function (params)
+ if not config.config.signatureHelp.enable then
+ return nil
+ end
+ local uri = params.textDocument.uri
+ if not files.exists(uri) then
+ return nil
+ end
+ local lines = files.getLines(uri)
+ local text = files.getText(uri)
+ local offset = define.offset(lines, text, params.position)
+ local core = require 'core.signature'
+ local results = core(uri, offset)
+ if not results then
+ return nil
+ end
+end)