diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-30 20:20:40 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-30 20:20:40 +0800 |
commit | add1ab2579609ba9ce9b94bd92dc6c6bf3e05413 (patch) | |
tree | 934a5ca7f4ddd3fd869a290fff2e2001b6ba61f6 /script | |
parent | 81bb05dee252e5da88cfcc9a9c7c78c9af42c738 (diff) | |
download | lua-language-server-add1ab2579609ba9ce9b94bd92dc6c6bf3e05413.zip |
ask for loading plugin
Diffstat (limited to 'script')
-rw-r--r-- | script/plugin.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/script/plugin.lua b/script/plugin.lua index 392b92af..26f39226 100644 --- a/script/plugin.lua +++ b/script/plugin.lua @@ -52,12 +52,14 @@ end local function checkTrustLoad() local filePath = LOGPATH .. '/trusted' - local trusted = util.loadFile(filePath) or '' + local trusted = util.loadFile(filePath) local lines = {} - for line in util.eachLine(trusted) do - lines[#lines+1] = line - if line == m.pluginPath then - return true + if trusted then + for line in util.eachLine(trusted) do + lines[#lines+1] = line + if line == m.pluginPath then + return true + end end end local _, index = client.awaitRequestMessage('Warning', lang.script('PLUGIN_TRUST_LOAD', m.pluginPath), { @@ -73,6 +75,10 @@ local function checkTrustLoad() end function m.init() + if m.hasInited then + return + end + m.hasInited = true await.call(function () local ws = require 'workspace' m.interface = {} |