dstein64 / nvim-scrollview

A Neovim plugin that displays interactive vertical scrollbars and signs.
MIT License
517 stars 9 forks source link

Bug: fold signs do not show up at all #98

Closed chrisgrieser closed 1 year ago

chrisgrieser commented 1 year ago

not sure how to check for the cause of this, but apparently, fold icons do not show up at all, even though they are included in signs_on_startup. They are apparently also the only sign group (that I use) that does not work, the rest works completely fine.

I am using nvim-ufo, in case that matters? 🤔

dstein64 commented 1 year ago

Thanks for reporting the issue @chrisgrieser. The plugin uses foldclosed() and foldclosedend(). Do those work as expected for you? The example below can be used for testing.

" Open a help window
:help
" Create a fold for the first line
zfj
" Check the output of calling foldclosed and foldclosedend
:echo foldclosed(1)
:echo foldclosedend(1)

The output should be 1 for foldclosed and 2 for foldclosedend. Is that what you're seeing?

dstein64 commented 1 year ago

If that works as expected, can you also try under the scenario where you noticed nvim-scrollview fold signs not working? In that case, the argument to both foldclosed and foldclosedend would be the line number where a fold starts. The output should be something other than -1 in both cases.

Fausto-Korpsvart commented 1 year ago

I have updated the plugins from Lazynvim and noticed the same thing, the folding icons are no longer displayed, and before updating they were displayed without any errors.

I have also noticed that the icons can no longer be overwritten, that is, I customized the icons and now only the default icons are shown, for example in the search icon, the equals symbol makes the bar look too messy when you do a search and there are many results, so I looked for some icons that were a little more subtle to display the results, the same with the diagnostic icons, but now does not show the ones I customized but the ones that bring by default the plugin. What is the correct way to change the icons? Because I have followed the instructions you give in the documentation.

dstein64 commented 1 year ago

@Fausto-Korpsvart, for the search symbols and diagnostic symbols, those can be customized with configuration variables.

For example, in Vimscript:

let g:scrollview_search_symbol = ['1', '2', '3', '#']
let g:scrollview_diagnostics_error_symbol = 'X'

Or in Lua:

-- Using configuration variables
vim.g.scrollview_search_symbol = {'1', '2', '3', '#'}
vim.g.scrollview_diagnostics_error_symbol = 'X'

-- Using a setup() call
require('scrollview').setup({
  ...
  search_symbol = {'1', '2', '3', '#'},
  diagnostics_error_symbol = 'X',
  ...
})

For the search setting, a list was used instead of a string so that the symbol will depend on the number of matches.

"Because I have followed the instructions you give in the documentation."

Further details, like the specific parts of documentation, would be appreciated, so I can make any necessary corrections.

If the above examples don't resolve the problem for you, can you create a separate issue? I think that the search and diagnostics issue you're encountering are separate from the fold sign issue.

dstein64 commented 1 year ago

@Fausto-Korpsvart, the symbol customization must be done prior to the plugin loading; changing afterwards won't work. The custom settings would have to be inserted in your Neovim configuration (e.g., init.vim or init.lua).

Fausto-Korpsvart commented 1 year ago

@Fausto-Korpsvart, for the search symbols and diagnostic symbols, those can be customized with configuration variables.

For example, in Vimscript:

let g:scrollview_search_symbol = ['1', '2', '3', '#']
let g:scrollview_diagnostics_error_symbol = 'X'

Or in Lua:

-- Using configuration variables
vim.g.scrollview_search_symbol = {'1', '2', '3', '#'}
vim.g.scrollview_diagnostics_error_symbol = 'X'

-- Using a setup() call
require('scrollview').setup({
  ...
  search_symbol = {'1', '2', '3', '#'},
  diagnostics_error_symbol = 'X',
  ...
})

For the search setting, a list was used instead of a string so that the symbol will depend on the number of matches.

"Because I have followed the instructions you give in the documentation."

Further details, like the specific parts of documentation, would be appreciated, so I can make any necessary corrections.

If the above examples don't resolve the problem for you, can you create a separate issue? I think that the search and diagnostics issue you're encountering are separate from the fold sign issue.

@dstein64, The way I had configured the plugin was with the setup() call:

            'dstein64/nvim-scrollview',
            event = 'BufReadPre',
            config = function()
                require('scrollview').setup {
                    winblend = 60,
                    column = 1,
                    signs_on_startup = { 'search', 'diagnostics', 'folds' },
                    diagnostics_error_symbol = '·',
                    diagnostics_hint_symbol = '·',
                    diagnostics_info_symbol = '·',
                    diagnostics_warn_symbol = '·',
                    folds_symbol = '',
                    search_symbol =  '·',
                }
                require('scrollview.contrib.gitsigns').setup()
            end,

but since the update it stopped working, so as you suggested I tried putting the configuration variables in the init.lua file and that has worked.

I also noticed that when I put BufReadPre in the Lazynvim event, the diagnostic icons it displayed were the ones I have set in the LSP file.

Further details, like the specific parts of documentation, would be appreciated, so I can make any necessary corrections.

And I should have expressed myself better, the documentation is well explained, I followed it step by step and before the update it worked very well, but after updating the icons were the only ones that stopped working, the rest kept working.

I think it might be necessary mentioning those changes in the documentation, maybe many use the default icons and that's why they haven't noticed that setting them from the setup() call doesn't work, and suggesting these changes in the documentation would be good.

Either way, thanks for the answer and solution, it's a very useful plugin.

chrisgrieser commented 1 year ago

@dstein64 okay, this is weird, after updating scrollview, the folds now show up just fine. I guess one of the commits done since yesterday unintentionally also fixed this issue? 🤔

Well, bugs that fix themselves are the best bugs I guess, so I'll close this, and re-open in case the issue re-occurs.

Thanks for the quick fixes!

dstein64 commented 1 year ago

@chrisgrieser, I'm glad to hear it works. Perhaps the fix for #99 addressed the problem. I guess my earlier comment to @Fausto-Korpsvart was incorrect: "I think that the search and diagnostics issue you're encountering are separate from the fold sign issue."