diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 16:19:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 16:19:06 +0800 |
commit | 69c0e4c50101ee29ac1459897495d4c1219bb8c8 (patch) | |
tree | a5d3ff6877e9aa5d86b27b10cb0451e8c46c50ac | |
parent | aa8982b66537e59822d4717f446de3e5dd83e72b (diff) | |
download | lua-language-server-69c0e4c50101ee29ac1459897495d4c1219bb8c8.zip |
cleanup
-rw-r--r-- | .vscode/launch.json | 2 | ||||
-rw-r--r-- | script/client.lua | 3 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 6 |
3 files changed, 9 insertions, 2 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index 078f26b3..c4194825 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -23,7 +23,7 @@ "name": "附加", "type": "lua", "request": "attach", - "stopOnEntry": true, + "stopOnEntry": false, "address": "127.0.0.1:11413", "outputCapture": [ ], 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 |