-
Notifications
You must be signed in to change notification settings - Fork 462
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
The mapping does not work as designed in debug mode #899
Comments
Cannot repro. We did test this before merging #877. This is a global keymap, so it's impossible for a specific buffer to have a different definition (unless overridden). And theoretically no LSP activity is allowed during this period. Can you provide a minimum repro so that we can look into this issue? |
How about |
Yes, it works as expect in visual mode. |
I'll test this keymap again tomorrow, I dont have the env setup right now. As u mentioned it might b/c lsp-related thingy is blocking the road, I think it might b/c some lsp somehow got reattach twice. |
I agree with you, I'm also very confused. But if I replace ["n|K"] = map_cmd("<Cmd>lua require('dapui').eval()<CR>")
:with_buffer(0)
:with_noremap()
:with_nowait()
:with_desc("debug: Evaluate expression under cursor"), it works (in the main code window of course). |
I'm not sure if this issue is caused by the problem of having multiple LSPs attached or something similar, since specifying the bufnr (:with_buffer(0)) seems to resolve it. In addition, the restoration method may not be comprehensive. The original K mapping is linked to those buffers with LSPs attached, but the restoration method does not specify this. |
Yeah I encountered this issue log ago, but forgot to port it upstream 🤦♂️ Thanks for the heads up! To be short, if the config (for |
@YuCao16 Can u provide a minimum repro? I have the correct setup prepared, but somehow cannot reproduce this 😢 |
Just guessing.
So the loading order might be:
If u give DAP keymap https://neovim.io/doc/user/api.html#nvim_buf_set_keymap() |
I try to create a easier way to reproduce this issue, could you please try this?
So the |
I think so ... but if so, why can't you reproduce it? |
Shall we just use another mechanism to setup key mapping, for example, based on filetype? I can send a pr if you accept. |
Yeah it's quite strange... I can reproduce #899 (comment) but the same thing doesn't apply to this issue. I'm checking the log to see if there's anything useful. |
But FWIW this keymap should be globally available in the current debug session, as the debugger could potentially switch files, and once the buffer changed, those keymaps will be invalidated. |
Oh I see where the issue is. I'm using Neovim v0.9.1 on this host, but once I switch to Neovim nighly, the problem appears: 執行 LspAttach Autocommands: "*"
autocommand <*>
autocommand <*>
...
執行 LspAttach Autocommands: "*"
autocommand <*>
...
執行 LspAttach Autocommands: "*"
autocommand <*>
...
執行 LspAttach Autocommands: "*"
autocommand <*>
...
執行 LspAttach Autocommands: "*"
autocommand <*>
...... Not sure why this event got triggered when no (new) LSP attached to that buffer... |
What if we set keymap based on filetype, for example |
V0.10.0-dev is the most bug-ridden version I've ever encountered. Almost every day I'm facing bugs that emerge from who knows where. |
That thought crossed my mind as well. But the issue is, some languages may have multiple filetypes that meet the criteria (e.g., |
Is |
TBH nightly builds have always been like this. We never know what the next "surprise" is :D |
If I explicitly specify |
IMO the most effective (and "economical") way is to revert #735, but is it worth it? |
Just bind |
In fact, this was my initial proposal ( |
Maybe detect if buffer with filetype |
Sorry I didn't get this, what's the point of detecting buffers with filetype |
I mean we can detect if there is a dapui's window so we know if we are in debug mode, dapui_scopes is one of them. |
I would prefer setting this up by registering callbacks during |
Agreed, that's more decent, thanks for your effort. |
@Jint-lzxy This seems happen again after merging the latest commit... |
@YuCao16 Ah yes many thanks for reminding me. This is now a specific issue for Neovim nightly, as these keymaps are set by repeated |
Version confirmation
Following prerequisites
Neovim version
NVIM v0.10.0-dev-618+g4fd852b8c
Operating system/version
Pop!_OS 22.04 LTS x86_64
Terminal name/version
kitty 0.28.1
$TERM environment variable
xterm-kitty
Branch info
main (Default/Latest)
Fetch Preferences
SSH (use_ssh = true)
How to reproduce the issue
Expected behavior
K is bound to
lua require("dapui").eval()
Actual behavior
K is bound to `Lspsaga hover_doc'
Additional information
In the most recent version, 'K' has been bound to lua require("dapui").eval(). However, in the main code window, this mapping has not been overwritten. There are two reasons for this:
I'm not sure if this is a real issue or a conflict between my own configuration and the current version. Could you please test it?
The text was updated successfully, but these errors were encountered: