Code Monkey home page Code Monkey logo

Comments (8)

eric-hansen avatar eric-hansen commented on August 24, 2024

I do wonder if using this code would work better for you? #14

Since it's been merged in, not sure when (if not already) it'll be set for release.

from zk-nvim.

prmadev avatar prmadev commented on August 24, 2024

I do wonder if using this code would work better for you? #14

Since it's been merged in, not sure when (if not already) it'll be set for release.

I think I'm already at the latest commit on main, which is one commit ahead of #14. And yet the problem persists, I'm not sure if the problem is caused by #14. Would you like me to try commits before its merge to see if the issue is present then as well?

from zk-nvim.

kabouzeid avatar kabouzeid commented on August 24, 2024

If you were trying this via your N mapping. This mapping
vim.api.nvim_set_keymap("v", "N", ":ZkNewFromTitleSelection<CR>", { noremap = true })
should be
vim.api.nvim_set_keymap("v", "N", ":'<'>ZkNewFromTitleSelection<CR>", { noremap = true }).

The '<'> is important here, Neovim will only update these marks after you leave visual mode. This makes sure to leave visual mode before executing the command.


Just to be sure: First you make a selection, and then hit : which should automatically insert :'<,'> for you, and the you complete this to :'<,'>ZkNewFromTitleSelection and hit enter. Is this what you're doing?

from zk-nvim.

prmadev avatar prmadev commented on August 24, 2024

y

If you were trying this via your N mapping. This mapping vim.api.nvim_set_keymap("v", "N", ":ZkNewFromTitleSelection<CR>", { noremap = true }) should be vim.api.nvim_set_keymap("v", "N", ":'<'>ZkNewFromTitleSelection<CR>", { noremap = true }).

The '<'> is important here, Neovim will only update these marks after you leave visual mode. This makes sure to leave visual mode before executing the command.

oh yeah, I actually changed that, just because I saw that it was repeated in the cmdline, just to see if it had anything to do with my problem. However, no tangible difference was made.

Just to be sure: First you make a selection, and then hit : which should automatically insert :'<,'> for you, and the you complete this to :'<,'>ZkNewFromTitleSelection and hit enter. Is this what you're doing?

Exactly. I have also tried differnet combinations of keymappings to invoke this function. Again, nothing substantial was changed.

I sometimes get lucky and the function executes correctly, but I am yet to pin-point the effective parameter.

from zk-nvim.

kabouzeid avatar kabouzeid commented on August 24, 2024

Just trying to pin this down; does it maybe work if you make a selection, then hit esc to go back to normal mode first, then manually type :'<,'>ZkNewFromTitleSelection?

from zk-nvim.

kabouzeid avatar kabouzeid commented on August 24, 2024

ok so I tracked it down now. there is a bug in this neovim 0.6.1 function (https://github.com/neovim/neovim/blob/b4fbb9dcf2752d95b9be335d99b0c55efb5f17de/runtime/lua/vim/lsp/util.lua#L193), which causes vim.lsp.util.make_given_range_params() to not always return the correct value on unsaved buffers.

I've made a workaround PR which fixes this on our side (https://github.com/mickael-menu/zk-nvim/pull/20/files), but I'll also create an issue/PR at Neovim to properly fix this on their side when I get time.

from zk-nvim.

kabouzeid avatar kabouzeid commented on August 24, 2024

Thanks for reporting! I was previously testing this with Neovim 0.6.0 where the bug is not present.

from zk-nvim.

kabouzeid avatar kabouzeid commented on August 24, 2024

I've reported this bug upstream. neovim/neovim#16985

from zk-nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.