Gesture for multi-line comments
I've read the discussion in the GraphQL repo about not supporting multi-line to simplify the spec and because most editors support a gesture for commenting / uncommenting multiple lines.
Has any consideration been given to adding to graphiql the ability to comment / uncomment similarly with a single gesture? Basically a keystroke / button that you could press after highlighting some text in the query window and it would immediately add or remove # within the highlighted text.
that works already @glennblock! try selecting a block of text and doing cmd + / or ctrl + /. try it here for example
Fantastic, thanks!
On Sun, Jun 23, 2019 at 6:57 AM Rikki Schulte [email protected] wrote:
Closed #787 https://github.com/graphql/graphiql/issues/787.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/graphql/graphiql/issues/787?email_source=notifications&email_token=AABCORFO3KX4OGHITRBK46DP356NVA5CNFSM4HFCXI2KYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOSD6GNAQ#event-2432460418, or mute the thread https://github.com/notifications/unsubscribe-auth/AABCORCZ7SU7YCBJX6QAM4LP356NVANCNFSM4HFCXI2A .
Doesn't work with a Danish keyboard, where / is on shift + 7. ctrl + shift + 7 does nothing :-(
Doesn't work with a Danish keyboard, where
/is onshift + 7.ctrl + shift + 7does nothing :-(
Same situation with Spanish keyboard. Ctrl + shift + 7 does nothing. I tried with several keys and I found it right next to the ENTER key. In the Spanish Keyboard it is the ç key. So, in windows, Spanish layout keyboard, Ctrl+ç comments out a block of query. This ç key is in the same position as the * ' key in the Danish layout.
Hola @freenrg - great that you found a workaround for Spanish keyboards. It doesn't work for Danish keyboards though. The button you're referring to gives ' when pressed and * when pressed with shift. Neither ctrl + ' nor ctrl + shift + ' do anything that was visible to me when I tried it here.
This already works in monaco-graphql, so folks are free to backport it to codemirror-graphql
In Portuguese keyboard this doesn't work either and the solutions provided above don't work because cmd+ç (I'm on a mac) maps to History Back shortcut in the browser.
The only solution I have is to switch to US keyboard and then use the cmd + / to do block comments.
This is a bug with codemirror from what I can tell? We just provide a simple string for the key combo to the codemirror api using extraKeys. I wish the codemirror docs had anchor links :/ . just find in page for extraKeys
https://codemirror.net/doc/manual.html
There is a single file where codemirror keeps all of these keymaps, and it biases for English keyboards I’m assuming, but this is the codemirror-graphql repo not the codemirror repo so there isn’t much we can do ourselves.
It might be we can just add more extraKeys to the graphiql/src/utilities/extraKeys.js helper so people have workarounds. This issue can only be solved internally in codemirror 5, or by adding more extraKeys
i only have access to US and german keyboards, can someone try https://monaco-graphql.netlify.com and see if this issue is resolved in monaco on their non-compatible keyboard?
i only have access to US and german keyboards, can someone try https://monaco-graphql.netlify.com/ and see if this issue is resolved in monaco on their non-compatible keyboard?
@acao I just tried on a Swedish layout, doesn't work there.
another solution may be to change the codemirror keyMap. graphiql 2.0.0 will still use codemirror 5 so it will remain the same for a while until 3.0.0
this is the current codemirror 5 sublime keyMap we use:
https://github.com/codemirror/codemirror5/blob/c401c299ce13cd99d8b6798a9bb21b443dec4493/keymap/sublime.js#L590
you can now in 1.x configure for vim or emacs for keyMap instead of the default
perhaps we can also expose more codemirror methods as props to allow customization of the default codemirror 5 keymaps. You can also submit issues to the codemirror 5 repository where these keymaps are defined!