From 264b0cc598efee9e87132d96596985a09d085798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 24 Jun 2019 17:16:13 +0800 Subject: =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8=20ignore=20?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/async/scanfiles.lua | 10 ++-------- server/src/files/files.lua | 1 + server/src/service.lua | 3 +++ server/src/workspace.lua | 5 ++++- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'server/src') diff --git a/server/src/async/scanfiles.lua b/server/src/async/scanfiles.lua index 7a08a86f..04867377 100644 --- a/server/src/async/scanfiles.lua +++ b/server/src/async/scanfiles.lua @@ -8,14 +8,8 @@ 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 - if mode == 'workspace' then - session = glob.gitignore(pattern, options) - elseif mode == 'library' then - session = glob.glob(pattern, options) - else - return - end + local session = glob.gitignore(pattern, options) + session:setInterface('type', function (path) local fullpath = root / path if not fs.exists(fullpath) then diff --git a/server/src/files/files.lua b/server/src/files/files.lua index e271e501..355f81a3 100644 --- a/server/src/files/files.lua +++ b/server/src/files/files.lua @@ -82,6 +82,7 @@ function mt:clearVM() for _, f in pairs(self._files) do f:removeVM() end + self._library = {} end function mt:eachFile() diff --git a/server/src/service.lua b/server/src/service.lua index 3dfcb5a5..87b9908e 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -275,6 +275,9 @@ end ---@param buf string ---@param compiled table function mt:readLibrary(uri, path, buf, compiled) + if not self:isLua(uri) then + return + end if not self:checkReadFile(uri, path, buf) then return end diff --git a/server/src/workspace.lua b/server/src/workspace.lua index 8865a1fb..3a67572a 100644 --- a/server/src/workspace.lua +++ b/server/src/workspace.lua @@ -114,7 +114,7 @@ function mt:buildLibraryRequests(options) requests[#requests+1] = { mode = 'library', root = fs.absolute(fs.path(path)):string(), - pattern = pattern == true and '*' or pattern, + pattern = pattern, options = options, } end @@ -164,6 +164,9 @@ function mt:scanFiles() count = count + 1 elseif mode == 'library' then local path = fs.path(...) + if not self:isLuaFile(path) then + return + end self._loadFileRequest:push(path:string(), 'library') count = count + 1 elseif mode == 'stop' then -- cgit v1.2.3