summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-16 16:54:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-16 16:54:05 +0800
commit143424062920433c7e3994248dfc5d935c337de0 (patch)
treeec0b0a427776bed2956d598e849e8b04dfc8efae
parent19dcd9a83dee0a641a9c2bf8326626c47c66b27d (diff)
downloadlua-language-server-143424062920433c7e3994248dfc5d935c337de0.zip
#306 fix scan workspace may fails
-rw-r--r--changelog.md3
-rw-r--r--script/workspace/workspace.lua14
2 files changed, 12 insertions, 5 deletions
diff --git a/changelog.md b/changelog.md
index 09d9a356..d3452f49 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# changelog
+## 1.7.1
+* `FIX` scan workspace may fails
+
## 1.7.0
`2020-12-16`
* `NEW` diagnostic: `undefined-field`
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index c76eec55..10e4b2c9 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -37,11 +37,15 @@ end
local function interfaceFactory(root)
return {
type = function (path)
- if fs.is_directory(fs.path(root .. '/' .. path)) then
- return 'directory'
- else
- return 'file'
- end
+ local result
+ pcall(function ()
+ if fs.is_directory(fs.path(root .. '/' .. path)) then
+ result = 'directory'
+ else
+ result = 'file'
+ end
+ end)
+ return result
end,
list = function (path)
local fullPath = fs.path(root .. '/' .. path)