diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-22 15:06:32 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-22 15:06:32 +0800 |
commit | df5bd5457ad450a0f57553ee587280bd79b43072 (patch) | |
tree | 7c77588ccb3e049c0fe166996786b9259ee60151 /script/core/signature.lua | |
parent | 99b2d0ee4994aceefca8911f8f9ec18a977aa909 (diff) | |
download | lua-language-server-df5bd5457ad450a0f57553ee587280bd79b43072.zip |
fix interface not show after `,`
Diffstat (limited to 'script/core/signature.lua')
-rw-r--r-- | script/core/signature.lua | 22 |
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 |