From 8ea9b5dcc7f7064bf5cb484bcb3893c045c010e8 Mon Sep 17 00:00:00 2001 From: linrongbin16 <6496887+linrongbin16@users.noreply.github.com> Date: Fri, 9 Oct 2026 02:22:10 +0000 Subject: [PATCH 1/5] chore(pr): auto-commit --- lua/gitlinker/commons/log.lua | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lua/gitlinker/commons/log.lua b/lua/gitlinker/commons/log.lua index 3479642..cea9364 100644 --- a/lua/gitlinker/commons/log.lua +++ b/lua/gitlinker/commons/log.lua @@ -66,14 +66,7 @@ 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) + vim.notify(line, level) end end end From 7d2c64d5da92125e629aff0276024943bf6cb5db Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Oct 2026 10:23:18 +0800 Subject: [PATCH 2/5] c --- .github/workflows/bump-commons.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-commons.yml b/.github/workflows/bump-commons.yml index 79dc442..4ddc0ef 100644 --- a/.github/workflows/bump-commons.yml +++ b/.github/workflows/bump-commons.yml @@ -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" From fc17a51341088976ea166744a4fb5ebd238f051d Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Oct 2026 10:29:48 +0800 Subject: [PATCH 3/5] c --- lua/gitlinker.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/gitlinker.lua b/lua/gitlinker.lua index 9a9ede1..4cfdc7b 100644 --- a/lua/gitlinker.lua +++ b/lua/gitlinker.lua @@ -261,17 +261,17 @@ local _link = function(opts) warn_on_file_change = opts.warn_on_file_change 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", + local msg = string.format( + "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(msg: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 From 9173cdbbece06003cc468cdc420cf47b18bd4d3b Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Oct 2026 10:31:19 +0800 Subject: [PATCH 4/5] c --- lua/gitlinker.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/gitlinker.lua b/lua/gitlinker.lua index 4cfdc7b..2b4ec78 100644 --- a/lua/gitlinker.lua +++ b/lua/gitlinker.lua @@ -261,12 +261,12 @@ local _link = function(opts) warn_on_file_change = opts.warn_on_file_change end if lk.file_changed and warn_on_file_change then - local msg = string.format( + local warning = string.format( "line numbers can be wrong, %s has changed since %s", lk.file, string.sub(lk.rev, 1, 8) ) - log.warn(msg:gsub("%%", "%%%%")) + log.warn(warning:gsub("%%", "%%%%")) end if message then From b49f96c8a920aa0c9b5460236fdd04006920cc3b Mon Sep 17 00:00:00 2001 From: linrongbin16 <6496887+linrongbin16@users.noreply.github.com> Date: Fri, 9 Oct 2026 02:36:21 +0000 Subject: [PATCH 5/5] build(deps): bump commons.nvim deps --- lua/gitlinker/commons/log.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lua/gitlinker/commons/log.lua b/lua/gitlinker/commons/log.lua index cea9364..f2a9bcf 100644 --- a/lua/gitlinker/commons/log.lua +++ b/lua/gitlinker/commons/log.lua @@ -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 @@ -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 @@ -66,7 +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 - vim.notify(line, level) + 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