summaryrefslogtreecommitdiff
path: root/script/async/scanfiles.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-20 21:55:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-20 21:55:41 +0800
commitc63b2e404d8d2bb984afe3678a5ba2b2836380cc (patch)
treea70661effacc7a29caa8d49583673ac4be2faaf5 /script/async/scanfiles.lua
parent85c5a4210e4447422cd5677369ae740ed65725a0 (diff)
downloadlua-language-server-c63b2e404d8d2bb984afe3678a5ba2b2836380cc.zip
remove the old version
Diffstat (limited to 'script/async/scanfiles.lua')
-rw-r--r--script/async/scanfiles.lua55
1 files changed, 0 insertions, 55 deletions
diff --git a/script/async/scanfiles.lua b/script/async/scanfiles.lua
deleted file mode 100644
index f5249c8e..00000000
--- a/script/async/scanfiles.lua
+++ /dev/null
@@ -1,55 +0,0 @@
-local args = ...
-
-require 'utility'
-local fs = require 'bee.filesystem'
-local glob = require 'glob'
-
-local function scan(mode, root, pattern, options)
- OUT:push('log', 'Scanning:', root:string())
- OUT:push('log', 'Scan pattern:', table.dump(pattern))
- OUT:push('log', 'Scan options:', table.dump(options))
- local session = glob.gitignore(pattern, options)
-
- session:setInterface('type', function (path)
- local fullpath = root / path
- if not fs.exists(fullpath) then
- return nil
- end
- if fs.is_directory(fullpath) then
- return 'directory'
- else
- return 'file'
- end
- return nil
- end)
- session:setInterface('list', function (path)
- local fullpath = root / path
- if not fs.exists(fullpath) then
- return nil
- end
- local list = {}
- for child in fullpath:list_directory() do
- list[#list+1] = child:string()
- end
- return list
- end)
-
- session:scan(function (path)
- local ok, msg = IN:pop()
- if ok and msg == 'stop' then
- OUT:push 'stop'
- return
- end
- OUT:push(mode, fs.absolute(root / path):string())
- end)
-end
-
-for _, data in ipairs(args) do
- local root = fs.path(data.root)
- local suc, err = xpcall(scan, debug.traceback, data.mode, root, data.pattern, data.options)
- if not suc then
- ERR:push(err)
- end
-end
-
-OUT:push 'ok'