Skip to content

using vim.keymap.set, breaking changes #200

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

Merged
merged 8 commits into from
Jul 3, 2022
Merged

using vim.keymap.set, breaking changes #200

merged 8 commits into from
Jul 3, 2022

Conversation

ray-x
Copy link
Owner

@ray-x ray-x commented Jul 2, 2022

image

Moving to new neovim API for key binding

The new way to bind a key is
{ key = 'gr', func = require('navigator.reference').async_ref, doc = 'async_ref' },
doc field is optional
Also as vim.keymap.set() only supported 0.7.x and greater so 0.6.x might no longer works.

Benefits:

  1. will not deprecate for a while
  2. native lua callback

But you may need to update the config if you override default keymappings. The string search will not work
e.g. in old config
{ key = 'gD', func = 'definition()'},
definition() is used to replace the internal old mapping
{ key = 'gd', func = 'definition()'},
and key gd will be removed from default config.

The new config
{ key = 'gD', func = vim.lsp.buf.definition},
new default:
{ key = 'gd', func = vim.lsp.buf.definition, doc='definition'},
It will search if function reference vim.lsp.buf.definition matches.

@ray-x ray-x merged commit acca600 into master Jul 3, 2022
@ray-x ray-x deleted the nvim_0_7 branch July 3, 2022 14:13
@avently
Copy link

avently commented Jul 4, 2022

doc field is optional

https://github.com/ray-x/navigator.lua/blob/master/lua/navigator/lspclient/mapping.lua#L213

Error executing vim.schedule lua callback: .../start/navigator.lua/lua/navigator/lspclient/mapping.lua:213: bad argument #1 to 'find' (string expected, got nil)

And the most strange part.
Icons overriding is broken in some unique way.
When I specify this:

require'navigator'.setup({
debug = false,
        lsp = {
          code_action = {
            virtual_text = false
          },
          diagnostic = {
            update_in_insert = false
          },
          format_on_save = false,
          disable_lsp = { "rust_analyzer" }
        },
        lsp_installer = true,
        lsp_signature_help = false,
        signature_help_cfg = nil,
 keymaps = {
-- THIS LINE AND ONLY THIS COMMAND MAKES ICONS NON WORKING. Other commands I add works fine. Removing this line makes everything working fine too
          { key = '<leader>ld', func = require('navigator.diagnostics').show_buf_diagnostics, doc = 'show_buf_diagnostics' },
 },
icons = {
diagnostic_virtual_text = ''
}
})

So diagnostic_virtual_text icon I specify is not used. Only your icon from source code is used and I know that because I see broken icon in it's place (I don't have nerd fonts). I just found this out by removing line-by-line from my config and this is what causes the icon to not be used. Who knows why...

Do know what can be a cause?

@ray-x
Copy link
Owner Author

ray-x commented Jul 4, 2022

@avently
Seems there are some dependency issues in the diagnostics module.
Pushed an update: 56b00b8

@avently
Copy link

avently commented Jul 4, 2022

Yep, now diagnostics icon is working, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants