diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-21 17:59:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-21 17:59:31 +0800 |
commit | 8683ecd814c99ee6aa4fe028798a007cb96bcdad (patch) | |
tree | e3e76e8036ae0e307080466a52e9d4f67eb125ea /server | |
parent | 4e09d04c5020970874599c48ad0af98abe8c8919 (diff) | |
download | lua-language-server-8683ecd814c99ee6aa4fe028798a007cb96bcdad.zip |
修正面向对象语法参数计算错误的问题
Diffstat (limited to 'server')
-rw-r--r-- | server/src/matcher/hover.lua | 6 | ||||
-rw-r--r-- | server/test/signature/init.lua | 22 |
2 files changed, 28 insertions, 0 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index 0caaa47a..dc7d40de 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -20,6 +20,9 @@ local function buildLibArgs(lib, oo, select) local start if oo then start = 2 + if select then + select = select + 1 + end else start = 1 end @@ -231,6 +234,9 @@ local function buildValueArgs(result, source, select) local start = 1 if source.object then start = 2 + if select then + select = select + 1 + end end local max if func.built then diff --git a/server/test/signature/init.lua b/server/test/signature/init.lua index 0c343384..bc3713d7 100644 --- a/server/test/signature/init.lua +++ b/server/test/signature/init.lua @@ -44,3 +44,25 @@ x(@) label = "function x(a: any, b: any)", arg = 'a: any' } + +TEST [[ +function mt:f(a) +end + +mt:f(@ +]] +{ + label = 'function mt:f(a: any)', + arg = 'a: any' +} + +TEST [[ +(''):sub(@ +]] +{ + label = [[ +function *string:sub(i: integer [, j: integer(-1)]) + -> string +]], + arg = 'i: integer' +} |