-- lx-bundle:true

--- Render delimited text files through the shared preview engine
-- @module plugins.tabpreview

local open_handler = require("core.open_handler")

--- Create one table preview for a supported text document
-- @param request table shared open request
-- @return table view rendered table view
local function create_preview(request)
	local TabPreview = require("plugins.tabpreview.view")

	return TabPreview(request.doc)
end

-- Delimited text formats choose this visual surface for preview mode
open_handler.register({
	name = "tabpreview",
	formats = { "csv", "tsv", "psv" },
	modes = { "preview" },
	create_view = create_preview,
})
