summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/hover/description.lua3
-rw-r--r--test/hover/init.lua9
2 files changed, 11 insertions, 1 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index e3acd07d..7b32c41c 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -56,6 +56,9 @@ end
local function asStringView(source, literal)
-- 内部包含转义符?
+ if not source[2] then
+ return
+ end
local rawLen = source.finish - source.start - 2 * #source[2]
if config.get(guide.getUri(source), 'Lua.hover.viewString')
and (source[2] == '"' or source[2] == "'")
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 5ee4db51..2ae6837f 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1737,7 +1737,7 @@ TEST [[
---@class A
local a
-local b = nil
+local b
b = a
print(b.<?x?>)
@@ -1809,3 +1809,10 @@ local <?uri?>
[[
local uri: string
]]
+
+TEST [[
+local <?x?> = '1' .. '2'
+]]
+[[
+local x: string = "12"
+]]