summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-17 15:32:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-17 15:32:44 +0800
commitc2d2e7a92461dafab0b3446cd30db67d00eed570 (patch)
tree2c31d3e01084f5dc460ebd9d65c250fc330fa76a /script/workspace
parent604d6a6aad7eaa173a4fb9d7dd49b8ac2f6976d9 (diff)
downloadlua-language-server-c2d2e7a92461dafab0b3446cd30db67d00eed570.zip
prepare client test
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/scope.lua12
-rw-r--r--script/workspace/workspace.lua8
2 files changed, 14 insertions, 6 deletions
diff --git a/script/workspace/scope.lua b/script/workspace/scope.lua
index 258f929c..85190f25 100644
--- a/script/workspace/scope.lua
+++ b/script/workspace/scope.lua
@@ -76,10 +76,14 @@ end
---@class scope.manager
local m = {}
----@type scope[]
-m.folders = {}
-m.override = createScope 'override'
-m.fallback = createScope 'fallback'
+function m.reset()
+ ---@type scope[]
+ m.folders = {}
+ m.override = createScope 'override'
+ m.fallback = createScope 'fallback'
+end
+
+m.reset()
---@param uri uri
---@return scope
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index ae33ad19..5fbc18b1 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -16,8 +16,6 @@ local loading = require 'workspace.loading'
---@class workspace
local m = {}
m.type = 'workspace'
----@type scope[]
-m.folders = {}
m.watchList = {}
--- 注册事件
@@ -53,6 +51,12 @@ function m.create(uri)
m.folders[#m.folders+1] = scp
end
+function m.reset()
+ ---@type scope[]
+ m.folders = {}
+ m.rootUri = nil
+end
+
function m.getRootUri(uri)
local scp = m.getScope(uri)
return scp.uri