From 5b4c96cb0bb19a60db155de74a376659e7adc4a4 Mon Sep 17 00:00:00 2001 From: Marc Hamamji Date: Mon, 10 Apr 2023 23:36:39 +0300 Subject: [PATCH] Add docs for `set_handler` function --- lua/runner/init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/runner/init.lua b/lua/runner/init.lua index f81d540..fa8d7e5 100644 --- a/lua/runner/init.lua +++ b/lua/runner/init.lua @@ -11,6 +11,19 @@ M.setup = function(options) config.setup(options) end +--- **Overrides** the handler for the specified filetype +--- +--- Usage: +--- ```lua +--- local helpers = require('runner.handlers.helpers') +--- require('runner').set_handler( +--- 'lua', +--- helpers.command_handler('luafile %'), +--- ) +--- ``` +--- +--- @param filetype string The filetype on which to run the given handler +--- @param handler function The handler to run when the current file matches the filetype M.set_handler = function(filetype, handler) M._handlers[filetype] = handler end