Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: staged_signs with legacy signs #799

Merged
merged 1 commit into from
May 25, 2023
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
15 changes: 8 additions & 7 deletions lua/gitsigns/signs/vimfn.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions teal/gitsigns/signs/vimfn.tl
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ end
local sign_define_cache: {string:table} = {}
local sign_name_cache: {string:string} = {}

local function get_sign_name(stype: string): string
if not sign_name_cache[stype] then
sign_name_cache[stype] = string.format(
'%s%s', 'GitSigns', capitalise_word(stype))
local function get_sign_name(name: string, stype: string): string
local key = name..stype
if not sign_name_cache[key] then
sign_name_cache[key] = string.format(
'%s%s%s', 'GitSigns', capitalise_word(key), capitalise_word(stype))
end

return sign_name_cache[stype]
return sign_name_cache[key]
end

local function sign_get(name: string): table
Expand All @@ -57,7 +58,7 @@ local function define_signs(obj: B, redefine: boolean)
-- Define signs
for stype, cs in pairs(obj.config) do
local hls = obj.hls[stype]
define_sign(get_sign_name(stype), {
define_sign(get_sign_name(obj.name, stype), {
texthl = hls.hl,
text = config.signcolumn and cs.text or nil,
numhl = config.numhl and hls.numhl or nil,
Expand Down Expand Up @@ -107,7 +108,7 @@ function M:add(bufnr: integer, signs: {M.Sign})
local to_place = {}

for _, s in ipairs(signs) do
local sign_name = get_sign_name(s.type)
local sign_name = get_sign_name(self.name, s.type)

local cs = self.config[s.type]
if config.signcolumn and cs.show_count and s.count then
Expand Down