summaryrefslogtreecommitdiff
path: root/script/fs-utility.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2024-02-26 10:58:00 +0800
committerGitHub <noreply@github.com>2024-02-26 10:58:00 +0800
commit73be83cacbe4a759a100a794e871c896a4692399 (patch)
treee761a59942ab07e6eab12fd7c260122b51a2ccf8 /script/fs-utility.lua
parentf388b95de3188e97d670bd6f1924325637446cf7 (diff)
parent87c83c38a3e1c4c617daeb104a0e31f5b1deaf1f (diff)
downloadlua-language-server-73be83cacbe4a759a100a794e871c896a4692399.zip
Merge pull request #2532 from fesily/automatic-infer-function-param-type
add infer function param type
Diffstat (limited to 'script/fs-utility.lua')
-rw-r--r--script/fs-utility.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/fs-utility.lua b/script/fs-utility.lua
index 9a45b1cc..8d2bf319 100644
--- a/script/fs-utility.lua
+++ b/script/fs-utility.lua
@@ -128,6 +128,7 @@ function dfs:__div(filename)
return new
end
+---@package
function dfs:_open(index)
local paths = split(self.path, '[/\\]')
local current = self.files
@@ -147,6 +148,7 @@ function dfs:_open(index)
return current
end
+---@package
function dfs:_filename()
return self.path:match '[^/\\]+$'
end
@@ -291,6 +293,7 @@ local function fsIsDirectory(path, option)
if path.type == 'dummy' then
return path:isDirectory()
end
+ ---@cast path -dummyfs
local status = fs.symlink_status(path):type()
return status == 'directory'
end
@@ -347,6 +350,7 @@ local function fsSave(path, text, option)
return false
end
if path.type == 'dummy' then
+ ---@cast path -fs.path
local dir = path:_open(-2)
if not dir then
option.err[#option.err+1] = '无法打开:' .. path:string()
@@ -385,6 +389,7 @@ local function fsLoad(path, option)
return nil
end
else
+ ---@cast path -dummyfs
local text, err = m.loadFile(path)
if text then
return text
@@ -407,6 +412,7 @@ local function fsCopy(source, target, option)
end
return fsSave(target, sourceText, option)
else
+ ---@cast source -dummyfs
if target.type == 'dummy' then
local sourceText, err = m.loadFile(source)
if not sourceText then