mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
plugin: linter: Use new onBufferOptionChanged
callback
This commit is contained in:
parent
415ceee46b
commit
771b84141f
@ -141,6 +141,32 @@ function onSave(bp)
|
||||
return true
|
||||
end
|
||||
|
||||
function onBufferOptionChanged(buf, option, old, new)
|
||||
if option == "filetype" then
|
||||
if old ~= new then
|
||||
for k, v in pairs(linters) do
|
||||
local ftmatch = old == v.filetype
|
||||
if v.domatch then
|
||||
ftmatch = string.match(old, v.filetype)
|
||||
end
|
||||
|
||||
local hasOS = contains(v.os, runtime.GOOS)
|
||||
if not hasOS and v.whitelist then
|
||||
ftmatch = false
|
||||
end
|
||||
if hasOS and not v.whitelist then
|
||||
ftmatch = false
|
||||
end
|
||||
|
||||
if ftmatch then
|
||||
buf:ClearMessages(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function lint(buf, linter, cmd, args, errorformat, loff, coff, callback)
|
||||
buf:ClearMessages(linter)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user