posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.83k stars 91 forks source link

Key bindings does not work in console #5330

Closed EdenGoldfarb closed 1 week ago

EdenGoldfarb commented 2 weeks ago

Positron Version: 2024.11.0 (system setup) build 140 Code - OSS Version: 1.93.0 Commit: e0d844b031f95acbf89f234a2cce2af9b6721f6c Date: 2024-10-31T14:14:22.699Z Electron: 30.4.0 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631

R 4.4.2

Key bindings such as "Insert the pipe operator" does not work in console.

{ "key": "ctrl+shift+m", "command": "r.insertPipeConsole", "when": "editorTextFocus && editorLangId == 'quarto' || editorTextFocus && editorLangId == 'r'" }

Can this be locally fixed through changing When Expression?

Many thanks.

juliasilge commented 1 week ago

We aren't able to reproduce this on our end in the R console, including on Windows. We do contribute the keybinding for the console specifically, with "when": "editorLangId == r":

https://github.com/posit-dev/positron/blob/d753d0dce92a116a0c6fe6e70cf7822b8e4243a2/extensions/positron-r/package.json#L379

Could you say in more detail what your setup is like and what steps you are taking?

EdenGoldfarb commented 1 week ago

Windows 11 pro 10.0.22631 Build 22631 I'm simply trying to insert a pipe "|>" using the key binding "ctrl+shift+m.". While I can insert it in the main editor (R, QMD), nothing happens when I try it in the CONSOLE.

I hope the snip below will help. what other details should I provide?

Image

juliasilge commented 1 week ago

Wow, so strange! Can you try this for us:

Image

This will bring print some output in the developer tools console that you can click to expand. It will show you all the context keys that are set, and we are particularly interested in finding what you have for positronConsoleFocused. I have positronConsoleFocused: true, which is what is expected here and what makes the command available:

Image

EdenGoldfarb commented 1 week ago

Well, it is also set to "true" -

Image

juliasilge commented 1 week ago

Can you successfully clear the console via Ctrl+L and/or paste into the console via Ctrl+V? Those are other keybindings that are set to apply only when PositronConsoleFocused.

jennybc commented 1 week ago

I'm wondering if someone else (eg an extension) is squatting on the keyboard shortcut.

Go to the command pallette and do Preferences: Open Keyboard Shortcuts.

Click on the little keyboard icon and then use the shortcut of interest (ctrl + shift + m, in your case, cmd + shift + m, in my case). What do you see? Here's what I see:

Image

EdenGoldfarb commented 1 week ago

Can you successfully clear the console via Ctrl+L and/or paste into the console via Ctrl+V? Those are other keybindings that are set to apply only when PositronConsoleFocused.

Yes, clearing and pastid do work in console.

I'm wondering if someone else (eg an extension) is squatting on the keyboard shortcut.

Go to the command pallette and do Preferences: Open Keyboard Shortcuts.

Click on the little keyboard icon and then use the shortcut of interest (ctrl + shift + m, in your case, cmd + shift + m, in my case). What do you see? Here's what I see:

Image

Image

Seems ok,

jennybc commented 1 week ago

Your screenshot shows that the keybinding for inserting the pipe operator in the Console is missing! From my screenshot, that's the one where the When clause starts like positronConsoleFocused && .... So that is the real problem. I can't immediately think of a reason that the other commands would successfully register, but this one would not 🤔

juliasilge commented 1 week ago

"View: Toggle Problems" is also missing, and that one is contributed by VS Code itself! 😱

@EdenGoldfarb have you done anything to remove keybindings, like this? Can you share what's in your settings.json and especially keybindings.json?

EdenGoldfarb commented 1 week ago

@juliasilge, I haven't done anything like that.

"View: Toggle Problems" is also missing, and that one is contributed by VS Code itself! 😱

@EdenGoldfarb have you done anything to remove keybindings, like this? Can you share what's in your settings.json and especially keybindings.json?

Image

EdenGoldfarb commented 1 week ago

update: Normal Windows uninstalling and installing again didn't help, as uninstalling won't remove many registry leftovers.

I used Revo Uninstaller to completely remove Positron and reinstalled it and the issue was fixed.

I'm going to reinstall all extensions that were previously installed and see if any lead to that bug.

Thank you both for the input and help.

juliasilge commented 1 week ago

Ah, see in your keybindings.json where it has -r.insertPipeConsole? With the -? This was the problem; at some point (probably by accident) you did something that removed this keybinding. You can get back to the default state by removing this entry from that JSON.