summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/files.lua9
-rw-r--r--script/plugin.lua4
-rw-r--r--script/provider/provider.lua4
3 files changed, 13 insertions, 4 deletions
diff --git a/script/files.lua b/script/files.lua
index e233846c..93e1e187 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -107,16 +107,23 @@ local function pluginOnSetText(file, text)
file._diffInfo = nil
local suc, result = plugin.dispatch('OnSetText', file.uri, text)
if not suc then
+ if DEVELOP and result then
+ util.saveFile(LOGPATH .. '/diffed.lua', tostring(result))
+ end
return text
end
if type(result) == 'string' then
return result
elseif type(result) == 'table' then
local diffs
- suc, result, diffs = xpcall(smerger.mergeDiff, log.warn, text, result)
+ suc, result, diffs = xpcall(smerger.mergeDiff, log.error, text, result)
if suc then
file._diffInfo = diffs
return result
+ else
+ if DEVELOP and result then
+ util.saveFile(LOGPATH .. '/diffed.lua', tostring(result))
+ end
end
end
return text
diff --git a/script/plugin.lua b/script/plugin.lua
index 06e3be82..3a053013 100644
--- a/script/plugin.lua
+++ b/script/plugin.lua
@@ -1,7 +1,7 @@
local config = require 'config'
local fs = require 'bee.filesystem'
local fsu = require 'fs-utility'
-local await = require "await"
+local await = require "await"
---@class plugin
local m = {}
@@ -20,7 +20,7 @@ function m.dispatch(event, ...)
if suc then
return true, res1, res2
end
- return false
+ return false, res1
end
function m.isReady()
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 71649a2f..4db7c3c1 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -173,7 +173,9 @@ proto.on('workspace/didChangeWatchedFiles', function (params)
end
elseif change.type == define.FileChangeType.Changed then
-- 如果文件处于关闭状态,则立即更新;否则等待didChange协议来更新
- if files.isLua(uri) and not files.isOpen(uri) then
+ if files.isLua(uri)
+ and not files.isOpen(uri)
+ and not workspace.isIgnored(uri) then
plugin.awaitReady()
files.setText(uri, pub.awaitTask('loadFile', uri), false)
else