summaryrefslogtreecommitdiff
path: root/script/plugin.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/plugin.lua')
-rw-r--r--script/plugin.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/script/plugin.lua b/script/plugin.lua
index 145abe74..bdd02ea8 100644
--- a/script/plugin.lua
+++ b/script/plugin.lua
@@ -4,6 +4,7 @@ local client = require 'client'
local lang = require 'language'
local await = require 'await'
local scope = require 'workspace.scope'
+local ws = require 'workspace'
---@class plugin
local m = {}
@@ -69,10 +70,10 @@ local function checkTrustLoad(scp)
return true
end
----@param scp scope
-function m.init(scp)
+---@param uri uri
+local function initPlugin(uri)
await.call(function () ---@async
- local ws = require 'workspace'
+ local scp = scope.getScope(uri)
local interface = {}
scp:set('pluginInterface', interface)
@@ -108,4 +109,10 @@ function m.init(scp)
end)
end
+ws.watch(function (ev, uri)
+ if ev == 'startReload' then
+ initPlugin(uri)
+ end
+end)
+
return m