lua/cosmic-ui/utils.lua
February 27, 2026 ยท View on GitHub
Intent
Provides shared helper functions used across rename/code actions/formatters, plus a logger wrapper that standardizes vim.notify calls with the configured title.
Exposed API
merge(...) -> table: Deep-merges tables usingvim.tbl_deep_extend("force", ...).get_relative_path(file_path) -> string: Converts an absolute URI/path into a path relative to current working directory.index_of(tbl, item) -> integer|nil: Returns the first list index matchingitem, ornilif not found.Logger:log(msg, opts?): Emits an info notification using the configured notify title.Logger:warn(msg, opts?): Emits a warning notification using the configured notify title.Logger:error(msg, opts?): Emits an error notification using the configured notify title.
Usage
local utils = require("cosmic-ui.utils")
local merged = utils.merge(
{ a = 1, nested = { x = true } },
{ nested = { y = true } }
)
local logger = require("cosmic-ui.utils").Logger
logger:warn("No LSP clients with code actions attached")