discover keybindings "when" conditionals #9503
-
| I recently met with some fantastic Positron helpers (at posit::conf) and they were helping me discover various components for defining keybindings. One of the tricks was using  In my case, I'm trying to determine if the text editor currently has a range of text highlighted/selected to differentiate certain action. Namely, on the first keypress I'd like to highlight between the previous and the next occurrence of  I've started with This is imperfect (it wraps in its search), but it starts the process. The next step would be to start a selection and go to the next occurrence of  All of that is one condition, when nothing is currently selected. When something is selected, I think I need to extend  (I'm learning how to learn this, though if you can also help with the list of commands to do this, that would also be appreciated. But please teach me to fish too :-) | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
| Thank you for the kind words, and for chatting with us at posit::conf! There are some context keys documented here: You might see if using  | 
Beta Was this translation helpful? Give feedback.
-
| Thanks! Something Sam showed me was the ability to go into DevTools and either activate something or type in a variable name that listed all of the current contexts. I suspect that's not intended for general consumption/use, but I found it particularly enlightening as I learn this new ecosystem. In addition to showing what is possible (your link), I think it showed what was currently active. Did I misinterpret what he was exploring? | 
Beta Was this translation helpful? Give feedback.

Ah yep, that is a super cool thing to be able to do! I think I didn't understand what you were asking about. First you run Developer: Toggle Developer Tools to bring up the Developer Tools console. Then you run Developer: Inspect Context Keys to set up the special functionality for seeing all the context keys. At this point you will have a special cursor that highlights exactly the part of the UI where you can explore it. Click where you are interested in, and then in the Developer Tools console you will see something like:
Click to expand that, and you will see all the context keys from the spot you clicked your cursor. You can read a bit more about this here:
https://code.visualstudio.…