2022-12-05 21:45:50 +08:00
|
|
|
local Event = require("lazy.core.handler.event")
|
|
|
|
local Loader = require("lazy.core.loader")
|
|
|
|
|
|
|
|
---@class LazyFiletypeHandler:LazyEventHandler
|
|
|
|
local M = {}
|
|
|
|
M.extends = Event
|
|
|
|
|
|
|
|
---@param plugin LazyPlugin
|
2022-12-16 16:13:08 +08:00
|
|
|
function M:add(plugin)
|
|
|
|
self.super.add(self, plugin)
|
|
|
|
if plugin.ft then
|
|
|
|
Loader.ftdetect(plugin.dir)
|
|
|
|
end
|
2022-12-05 21:45:50 +08:00
|
|
|
end
|
|
|
|
|
2023-10-17 04:34:44 +08:00
|
|
|
---@return LazyEvent
|
|
|
|
function M:_parse(value)
|
2023-10-11 20:25:10 +08:00
|
|
|
return {
|
|
|
|
id = value,
|
|
|
|
event = "FileType",
|
|
|
|
pattern = value,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2022-12-05 21:45:50 +08:00
|
|
|
return M
|