diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-04 16:39:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-04 16:39:49 +0800 |
commit | 6e7c082aa3e1011cdecd1761f7d04eabc0e2b8ba (patch) | |
tree | bbb69bdde3ef94b47269d18251834637873428a3 | |
parent | 9699b6c6f6ee1ce658bc93343479b5271c18b7f4 (diff) | |
download | lua-language-server-6e7c082aa3e1011cdecd1761f7d04eabc0e2b8ba.zip |
fix #377 watched file must check workspace
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/provider/provider.lua | 4 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 6 |
3 files changed, 11 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index cca22554..c2712000 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * `FIX` [#356](https://github.com/sumneko/lua-language-server/issues/356) * `FIX` [#375](https://github.com/sumneko/lua-language-server/issues/375) * `FIX` [#376](https://github.com/sumneko/lua-language-server/issues/376) +* `FIX` [#377](https://github.com/sumneko/lua-language-server/issues/377) * `FIX` [#378](https://github.com/sumneko/lua-language-server/issues/378) * `FIX` [#379](https://github.com/sumneko/lua-language-server/issues/379) diff --git a/script/provider/provider.lua b/script/provider/provider.lua index a7927715..71649a2f 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -157,6 +157,9 @@ end) proto.on('workspace/didChangeWatchedFiles', function (params) for _, change in ipairs(params.changes) do local uri = change.uri + if not workspace.isWorkspaceUri(uri) then + goto CONTINUE + end if change.type == define.FileChangeType.Created then log.debug('FileChangeType.Created', uri) workspace.awaitLoadFile(uri) @@ -184,6 +187,7 @@ proto.on('workspace/didChangeWatchedFiles', function (params) end end end + ::CONTINUE:: end end) diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 667a05f2..88451940 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -434,6 +434,12 @@ function m.getRelativePath(uri) end end +function m.isWorkspaceUri(uri) + local luri = files.getUri(uri) + local ruri = files.getUri(m.uri) + return luri:sub(1, #ruri) == ruri +end + --- 获取工作区等级的缓存 function m.getCache(name) if not m.cache[name] then |