diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-06-26 18:09:32 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-06-26 18:09:32 +0800 |
commit | 6fb028ef9e053076170ed03e46b9a4ab5d248e0c (patch) | |
tree | 0083af91c2dbdccfe44047db461a8b989ae8d788 /server/src/method | |
parent | f8407a7ed2faa1892ab63fbaed5539420af90180 (diff) | |
download | lua-language-server-6fb028ef9e053076170ed03e46b9a4ab5d248e0c.zip |
参数提示支持多原型
Diffstat (limited to 'server/src/method')
-rw-r--r-- | server/src/method/textDocument/signatureHelp.lua | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/server/src/method/textDocument/signatureHelp.lua b/server/src/method/textDocument/signatureHelp.lua index 9829917d..fa8c91f6 100644 --- a/server/src/method/textDocument/signatureHelp.lua +++ b/server/src/method/textDocument/signatureHelp.lua @@ -12,28 +12,40 @@ return function (lsp, params) return end + local description = hovers[1].description + table.sort(hovers, function (a, b) + return a.label < b.label + end) + + local active local signatures = {} for i, hover in ipairs(hovers) do - signatures[i] = { + local signature = { label = hover.label, documentation = { kind = 'markdown', value = hover.description, }, - parameters = { + } + if hover.argLabel then + if not active then + active = i + end + signature.parameters = { { label = { hover.argLabel[1] - 1, hover.argLabel[2], - }, - }, - }, - } + } + } + } + end + signatures[i] = signature end local response = { signatures = signatures, - activeSignature = 0, + activeSignature = active and active - 1 or 0, } return response |