Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bump-commons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ github.ref != 'refs/heads/master' }}
with:
commit_message: "chore(pr): auto-commit"
commit_message: "build(deps): bump commons.nvim deps"
6 changes: 3 additions & 3 deletions lua/gitlinker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,16 @@ local _link = function(opts)
end
if lk.file_changed and warn_on_file_change then
local warning = string.format(
"Line numbers can be wrong, %s has changed since %s",
"line numbers can be wrong, %s has changed since %s",
lk.file,
string.sub(lk.rev, 1, 8)
)
vim.notify(warning:gsub("%%", "%%%%"), vim.log.levels.WARN)
log.warn(warning:gsub("%%", "%%%%"))
end

if message then
---@diagnostic disable-next-line: need-check-nil
vim.notify(url:gsub("%%", "%%%%") --[[@as string]])
log.info(url:gsub("%%", "%%%%") --[[@as string]])
end

return url
Expand Down
19 changes: 9 additions & 10 deletions lua/gitlinker/commons/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local LogConfigs = {
file_name = nil,
}

--- @param opts {name: string, level: integer?, use_console: boolean?, use_file: boolean?, file_name: string?}?
--- @param opts {name: string?, level: integer?, use_console: boolean?, use_file: boolean?, file_name: string?}?
local function setup(opts)
opts = opts or {}
local level = opts.level or LogLevels.INFO
Expand All @@ -45,7 +45,9 @@ local function setup(opts)
local name = opts.name
local file_name = opts.file_name

LogConfigs.name = name
if type(name) == "string" and string.len(name) > 0 then
LogConfigs.name = name
end
LogConfigs.level = level
LogConfigs.use_console = use_console
LogConfigs.use_file = use_file
Expand All @@ -66,14 +68,11 @@ local function log(level, msg)
if LogConfigs.use_console and level >= LogLevels.INFO then
for _, line in ipairs(msg_lines) do
if type(line) == "string" and string.len(line) > 0 then
local msg_chunks = {}
table.insert(msg_chunks, {
string.format("[%s] %s", LogConfigs.name, line),
LogHighlights[level],
})
vim.schedule(function()
vim.api.nvim_echo(msg_chunks, true, {})
end)
local fmt_line = line
if type(LogConfigs.name) == "string" and string.len(LogConfigs.name) > 0 then
fmt_line = string.format("[%s] %s", LogConfigs.name, line)
end
vim.notify(fmt_line, level)
end
end
end
Expand Down
Loading