summaryrefslogtreecommitdiff
path: root/script-beta/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-16 17:07:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-16 17:07:02 +0800
commit1c226d739cc96f83e57b41b39e38692d16679803 (patch)
treec930a2eb94b2f33d7b0525b42ac4e93d658c6acd /script-beta/core
parent92f14830b446ac46338c97344517e5cc50972aab (diff)
downloadlua-language-server-1c226d739cc96f83e57b41b39e38692d16679803.zip
判空
Diffstat (limited to 'script-beta/core')
-rw-r--r--script-beta/core/hover/name.lua3
-rw-r--r--script-beta/core/semantic-tokens.lua3
2 files changed, 6 insertions, 0 deletions
diff --git a/script-beta/core/hover/name.lua b/script-beta/core/hover/name.lua
index 83b779db..a1c40771 100644
--- a/script-beta/core/hover/name.lua
+++ b/script-beta/core/hover/name.lua
@@ -29,6 +29,9 @@ local function asField(source)
end
local function asTableField(source)
+ if not source.field then
+ return
+ end
return guide.getName(source.field)
end
diff --git a/script-beta/core/semantic-tokens.lua b/script-beta/core/semantic-tokens.lua
index 25b66adc..996ebb98 100644
--- a/script-beta/core/semantic-tokens.lua
+++ b/script-beta/core/semantic-tokens.lua
@@ -39,6 +39,9 @@ Care['getglobal'] = function (source, results)
end
Care['tablefield'] = function (source, results)
local field = source.field
+ if not field then
+ return
+ end
results[#results+1] = {
start = field.start,
finish = field.finish,