diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-15 21:14:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-15 21:14:01 +0800 |
commit | fcbd709d4d680dab952f19275d23a78160e2d619 (patch) | |
tree | 93be1bdc49a920645bdd4d0c55242593f02c4542 /script-beta/provider | |
parent | 2dfcd22e91e12515e0bba146de4cb57e539d7d25 (diff) | |
download | lua-language-server-fcbd709d4d680dab952f19275d23a78160e2d619.zip |
更新
Diffstat (limited to 'script-beta/provider')
-rw-r--r-- | script-beta/provider/capability.lua | 6 | ||||
-rw-r--r-- | script-beta/provider/provider.lua | 18 |
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) |