summaryrefslogtreecommitdiff
path: root/script/workspace/workspace.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-29 02:27:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-29 02:27:13 +0800
commit4190a3e8ebd0ff1408fc47927394970de952f18c (patch)
tree46d4ef193af05ef864a839135e990f6f5f5b2810 /script/workspace/workspace.lua
parent87288efc77c68be375d6c534109f734f2cc99df9 (diff)
downloadlua-language-server-4190a3e8ebd0ff1408fc47927394970de952f18c.zip
fix runtime errors reported by telemetry
Diffstat (limited to 'script/workspace/workspace.lua')
-rw-r--r--script/workspace/workspace.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 973ae9ec..e69a4be4 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -404,12 +404,15 @@ function m.normalize(path)
return path
end
----@param folderUri uri
+---@param folderUri? uri
---@param path string
----@return string
+---@return string?
function m.getAbsolutePath(folderUri, path)
path = m.normalize(path)
if fs.path(path):is_relative() then
+ if not folderUri then
+ return nil
+ end
local folderPath = furi.decode(folderUri)
path = m.normalize(folderPath .. '/' .. path)
end