summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/document-symbol.lua5
-rw-r--r--script/parser/guide.lua3
-rw-r--r--script/provider/diagnostic.lua3
3 files changed, 9 insertions, 2 deletions
diff --git a/script/core/document-symbol.lua b/script/core/document-symbol.lua
index 7392b337..f06e613c 100644
--- a/script/core/document-symbol.lua
+++ b/script/core/document-symbol.lua
@@ -76,8 +76,9 @@ local function buildTable(tbl)
if not field then
break
end
- if field.type == 'tablefield' then
- buf[i] = ('%s'):format(field.field[1])
+ if field.type == 'tablefield'
+ and field.field then
+ buf[#buf+1] = ('%s'):format(field.field[1])
end
end
return table.concat(buf, ', ')
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 10668968..fac436eb 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -179,6 +179,9 @@ function m.getBlock(obj)
if blockTypes[tp] then
return obj
end
+ if obj == obj.parent then
+ error('obj == obj.parent?', obj.type)
+ end
obj = obj.parent
end
error('guide.getBlock overstack')
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index b155a591..1d8b779d 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -64,6 +64,9 @@ end
local function buildDiagnostic(uri, diag)
local lines = files.getLines(uri)
local text = files.getText(uri)
+ if not text or not lines then
+ return
+ end
local relatedInformation
if diag.related then