summaryrefslogtreecommitdiff
path: root/server-beta/src/proto/provider.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-23 18:59:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-23 18:59:57 +0800
commit4e1937f19ed61d3e7163aa06e267f3e92489e321 (patch)
treeacbdea488c5ab38db080d2ff44360e4611f1dbbd /server-beta/src/proto/provider.lua
parent7e9154e64d2a743903b1f9400bd254a039816ca0 (diff)
downloadlua-language-server-4e1937f19ed61d3e7163aa06e267f3e92489e321.zip
修正一些报错
Diffstat (limited to 'server-beta/src/proto/provider.lua')
-rw-r--r--server-beta/src/proto/provider.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/server-beta/src/proto/provider.lua b/server-beta/src/proto/provider.lua
index 3e89a50c..01121a15 100644
--- a/server-beta/src/proto/provider.lua
+++ b/server-beta/src/proto/provider.lua
@@ -68,6 +68,9 @@ proto.on('textDocument/definition', function (params)
local core = require 'core.definition'
local uri = params.textDocument.uri
local ast = files.getAst(uri)
+ if not ast then
+ return nil
+ end
local text = files.getText(uri)
local offset = inte.offset(ast.lines, text, params.position)
local result = core(ast, text, offset)