-
Notifications
You must be signed in to change notification settings - Fork 51
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
XCode Folding Ribbon #24
Comments
High priority for this feature. |
🐮 |
@kevinhwang91 I don't fully understand some of the issue you are seeing, but the result of the screenshot so far looks great. I'm guessing that the highlights are in slightly wrong places because of confusing behaviour of nvim folds maybe |
IMO, must highlight the current fold range with uppe/lower or the bar body, otherwise, it's useless. |
I get sucked with the UI. There're many potential errors that need to handle. BTW, |
I love the appearance of the xcode folding ribbon. Thanks for sharing it! Looks like the lower bounds do not add lot's of value, so it's ok to omit them. Regarding the upper boundary: what if just leave the arrow as it is? That is the only change to make is to encode levels of a fold with a color instead of a number 🤔 |
Not bad, but must solve the perf first, I will give a try if I have time. |
@kevinhwang91 whatever comes of this, your prototype looks really cool! |
Hi, Kevin, this looks great. Do you mind pushing the branch yet? Ik it's WIP, but I could be an alpha tester 😆 Btw, does your new feature depend on the patch to nvim? |
@WhiteBlackGoose Thanks for your attention. |
Oh, I see, sad :/ |
@WhiteBlackGoose Maybe can get better perf to use |
Nice, good luck with that! |
The ribbon is slightly more complicated than the VSCode style. The perf is not bad. Less than 1ms regression in a redraw even if a monitor in portrait orientation with hundred visible lines. Go ahead if |
I was trying to do the vscode style markers using the status column, could make it work with treesitter method(not ufo), couldn't figure out how to convert promise to a function that could be fed into the status column opt, can you help me with that? I was trying to use the ufo.getFolds() method |
Is there any code available showing how to achieve this affect? If anyone wants to use the unfinished feature now |
No, will implement it if I have spare time. |
Thank you. Also I managed to create a minimal version of this without the start and end indicators. If anyone is interested: {
'luukvbaal/statuscol.nvim',
config = function()
local builtin = require('statuscol.builtin')
local c = require('statuscol.ffidef').C
local util = require('utils')
for i = 0, 8, 1 do
vim.api.nvim_set_hl(0, 'FoldCol' .. i, {
bg = util.blend(
string.format(
'#%06x',
vim.api.nvim_get_hl(0, { name = 'Normal' }).fg
),
string.format(
'#%06x',
vim.api.nvim_get_hl(0, { name = 'Normal' }).bg
),
0.125 * i
),
})
end
require('statuscol').setup {
relculright = true,
segments = {
{ text = { '%s' }, click = 'v:lua.ScSa' },
{ text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa' },
{
-- hl = 'FoldColumn',
text = {
function(args)
local fold_level = c.fold_info(args.wp, args.lnum).level
local hl = '%#FoldCol' .. fold_level .. '#'
if fold_level > 8 then
hl = '%#FoldCol8#'
end
return hl .. ' '
end,
},
click = 'v:lua.ScFa',
},
},
}
end,
}, Util functions: local function hexToRgb(hex_str)
local hex = '[abcdef0-9][abcdef0-9]'
local pat = '^#(' .. hex .. ')(' .. hex .. ')(' .. hex .. ')$'
hex_str = string.lower(hex_str)
assert(
string.find(hex_str, pat) ~= nil,
'hex_to_rgb: invalid hex_str: ' .. tostring(hex_str)
)
local r, g, b = string.match(hex_str, pat)
return { tonumber(r, 16), tonumber(g, 16), tonumber(b, 16) }
end
function M.blend(fg, bg, alpha)
bg = hexToRgb(bg)
fg = hexToRgb(fg)
local blendChannel = function(i)
local ret = (alpha * fg[i] + ((1 - alpha) * bg[i]))
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end
return string.format(
'#%02X%02X%02X',
blendChannel(1),
blendChannel(2),
blendChannel(3)
)
end |
Feature description
CodeEditApp/CodeEditTextView#43
Describe the solution you'd like
Use the sign columnUse floating windowAdditional context
No response
The text was updated successfully, but these errors were encountered: