summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-18 16:19:06 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-18 16:19:06 +0800
commit69c0e4c50101ee29ac1459897495d4c1219bb8c8 (patch)
treea5d3ff6877e9aa5d86b27b10cb0451e8c46c50ac /script
parentaa8982b66537e59822d4717f446de3e5dd83e72b (diff)
downloadlua-language-server-69c0e4c50101ee29ac1459897495d4c1219bb8c8.zip
cleanup
Diffstat (limited to 'script')
-rw-r--r--script/client.lua3
-rw-r--r--script/workspace/workspace.lua6
2 files changed, 8 insertions, 1 deletions
diff --git a/script/client.lua b/script/client.lua
index ae11d119..cd956f19 100644
--- a/script/client.lua
+++ b/script/client.lua
@@ -119,6 +119,7 @@ end
function m.watchFiles(path)
path = path:gsub('\\', '/')
+ :gsub('[%[%]%{%}%*%?]', '\\%1')
local registration = {
id = path,
method = 'workspace/didChangeWatchedFiles',
@@ -127,7 +128,7 @@ function m.watchFiles(path)
{
globPattern = path .. '/**',
kind = 1 | 2 | 4,
- }
+ },
},
},
}
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 73b6138d..b79a678b 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -25,6 +25,7 @@ m.fileFound = 0
m.waitingReady = {}
m.requireCache = {}
m.cache = {}
+m.watchers = {}
m.matchOption = {
ignoreCase = platform.OS == 'Windows',
}
@@ -297,6 +298,10 @@ function m.awaitPreload()
m.fileLoaded = 0
m.fileFound = 0
m.cache = {}
+ for i, watchers in ipairs(m.watchers) do
+ watchers()
+ m.watchers[i] = nil
+ end
local progressBar <close> = progress.create(lang.script.WORKSPACE_LOADING)
local progressData = {
max = 0,
@@ -322,6 +327,7 @@ function m.awaitPreload()
local libraryLoader = loadFileFactory(library.path, progressData, true)
log.info('Scan library at:', library.path)
library.matcher:scan(library.path, libraryLoader)
+ m.watchers[#m.watchers+1] = client.watchFiles(library.path)
end
local isLoadingFiles = false