summaryrefslogtreecommitdiff
path: root/script/glob/gitignore.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-05-25 18:05:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-05-25 18:05:02 +0800
commit99e124ef95b65fe29f56cb5492538585574e8ded (patch)
treebe7733d737a72ec4cefcadce7814ea1b917b015f /script/glob/gitignore.lua
parentc586a11e9ae9b3f001c39d7f2f6762b0cf7af671 (diff)
downloadlua-language-server-99e124ef95b65fe29f56cb5492538585574e8ded.zip
don't scan huge directories
* if `rootUri` or `workspaceFolder` is set to `ROOT` or `HOME`, this extension will refuse to load these directories and show an error message. * show warning message when scanning more than 100,000 files.
Diffstat (limited to 'script/glob/gitignore.lua')
-rw-r--r--script/glob/gitignore.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/script/glob/gitignore.lua b/script/glob/gitignore.lua
index 4dad2747..a6a3df3e 100644
--- a/script/glob/gitignore.lua
+++ b/script/glob/gitignore.lua
@@ -164,8 +164,9 @@ function mt:getRelativePath(path)
end
---@param callback async fun(path: string)
+---@param hook? async fun(ev: string, ...)
---@async
-function mt:scan(path, callback)
+function mt:scan(path, callback, hook)
local files = {}
if type(callback) ~= 'function' then
callback = nil
@@ -203,6 +204,9 @@ function mt:scan(path, callback)
break
end
list[#list] = nil
+ if hook then
+ hook('scan', current)
+ end
if not self:simpleMatch(current) then
check(current)
end