summaryrefslogtreecommitdiff
path: root/script/core/signature.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-22 15:06:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-22 15:06:32 +0800
commitdf5bd5457ad450a0f57553ee587280bd79b43072 (patch)
tree7c77588ccb3e049c0fe166996786b9259ee60151 /script/core/signature.lua
parent99b2d0ee4994aceefca8911f8f9ec18a977aa909 (diff)
downloadlua-language-server-df5bd5457ad450a0f57553ee587280bd79b43072.zip
fix interface not show after `,`
Diffstat (limited to 'script/core/signature.lua')
-rw-r--r--script/core/signature.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/script/core/signature.lua b/script/core/signature.lua
index ab6d133a..295b5437 100644
--- a/script/core/signature.lua
+++ b/script/core/signature.lua
@@ -99,11 +99,33 @@ local function makeSignatures(call, pos)
return signs
end
+local function isSpace(char)
+ if char == ' '
+ or char == '\n'
+ or char == '\r'
+ or char == '\t' then
+ return true
+ end
+ return false
+end
+
+local function skipSpace(text, offset)
+ for i = offset, 1, -1 do
+ local char = text:sub(i, i)
+ if not isSpace(char) then
+ return i
+ end
+ end
+ return 0
+end
+
return function (uri, pos)
local ast = files.getAst(uri)
if not ast then
return nil
end
+ local text = files.getText(uri)
+ pos = skipSpace(text, pos)
local call = findNearCall(uri, ast, pos)
if not call then
return nil