summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-24 17:16:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-24 17:16:13 +0800
commit264b0cc598efee9e87132d96596985a09d085798 (patch)
tree027b70ed8126f03c054d89b818791333a1a74689 /server/src
parent0e3c22455e4398541471351291522b200417e31c (diff)
downloadlua-language-server-264b0cc598efee9e87132d96596985a09d085798.zip
统一使用 ignore 语法吧
Diffstat (limited to 'server/src')
-rw-r--r--server/src/async/scanfiles.lua10
-rw-r--r--server/src/files/files.lua1
-rw-r--r--server/src/service.lua3
-rw-r--r--server/src/workspace.lua5
4 files changed, 10 insertions, 9 deletions
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