diff options
-rw-r--r-- | server/src/matcher/hover.lua | 4 | ||||
-rw-r--r-- | server/test/hover/init.lua | 17 |
2 files changed, 17 insertions, 4 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index 09b2e071..de2eeffb 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -399,6 +399,10 @@ return function (result, source, lsp, select) return end + if result.key == '' then + return + end + if result.type == 'string' then return getStringHover(result, lsp) end diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index 9b22e3dd..18a5e299 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -14,10 +14,14 @@ function TEST(script) assert(vm) local result, source = matcher.findResult(vm, pos) local hover = matcher.hover(result, source) - assert(hover) - expect = expect:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - local label = hover.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - assert(expect == label) + if expect then + assert(hover) + expect = expect:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') + local label = hover.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') + assert(expect == label) + else + assert(hover == nil) + end end end @@ -248,3 +252,8 @@ table.pack(n) [[ any n ]] + +TEST [[ +(<?'xxx'?>):sub() +]] +(nil) |