diff options
author | sumneko <sumneko@hotmail.com> | 2019-05-08 14:37:49 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-05-08 14:37:49 +0800 |
commit | 3021033d1b11e916c93cfe78dcc9056366837ff6 (patch) | |
tree | d01116438c67c3eaed9a5dec0ecd2d8957816a15 /server/src/method | |
parent | c421e5c29e1cc6302739e69cdc8c9b7310a00e1a (diff) | |
download | lua-language-server-3021033d1b11e916c93cfe78dcc9056366837ff6.zip |
整理代码
Diffstat (limited to 'server/src/method')
-rw-r--r-- | server/src/method/initialized.lua | 6 | ||||
-rw-r--r-- | server/src/method/workspace/didChangeWatchedFiles.lua | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/server/src/method/initialized.lua b/server/src/method/initialized.lua index ab05c2b3..05abffd7 100644 --- a/server/src/method/initialized.lua +++ b/server/src/method/initialized.lua @@ -16,9 +16,9 @@ local function initAfterConfig(lsp, firstScope) registerOptions = { watchers = { { - globPattern = '**/*.lua', - kind = 1 | 4, -- Create | Change | Delete - }, + globPattern = '**/', + kind = 1 | 4, + } }, }, }, diff --git a/server/src/method/workspace/didChangeWatchedFiles.lua b/server/src/method/workspace/didChangeWatchedFiles.lua index a5fecac3..7e1afb92 100644 --- a/server/src/method/workspace/didChangeWatchedFiles.lua +++ b/server/src/method/workspace/didChangeWatchedFiles.lua @@ -1,3 +1,5 @@ +local fs = require 'bee.filesystem' + local FileChangeType = { Created = 1, Changed = 2, @@ -10,10 +12,11 @@ return function (lsp, params) end local needReset for _, change in ipairs(params.changes) do + local path = lsp.workspace:uriDecode(change.uri) if change.type == FileChangeType.Created then - lsp.workspace:addFile(change.uri) + lsp.workspace:addFile(path) elseif change.type == FileChangeType.Deleted then - lsp.workspace:removeFile(change.uri) + lsp.workspace:removeFile(path) end if lsp:getVM(change.uri) then needReset = true |