2024-02-19 14:27:17 +00:00
|
|
|
local table_utils = require("codesnap.utils.table")
|
2024-02-14 17:15:26 +00:00
|
|
|
local static = require("codesnap.static")
|
2024-02-19 14:27:17 +00:00
|
|
|
local client = require("codesnap.client")
|
|
|
|
local visual_utils = require("codesnap.utils.visual")
|
2024-02-14 17:15:26 +00:00
|
|
|
|
2024-02-13 06:05:36 +00:00
|
|
|
local main = {}
|
|
|
|
|
|
|
|
function main.setup(config)
|
2024-02-19 14:27:17 +00:00
|
|
|
static.config = table_utils.merge(static.config, config == nil and {} or config)
|
|
|
|
|
|
|
|
print(vim.inspect(static.config))
|
|
|
|
print(table_utils.serialize_json(static.config))
|
|
|
|
print()
|
|
|
|
|
|
|
|
if static.config.auto_load then
|
|
|
|
client:start()
|
|
|
|
end
|
|
|
|
|
|
|
|
client:send("config_setup", static.config)
|
|
|
|
end
|
|
|
|
|
|
|
|
function main.preview_code()
|
|
|
|
client:send("preview_code", { content = visual_utils.get_selected_text(), language = vim.bo.filetype })
|
2024-02-13 06:05:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return main
|