()
| 406 | |
| 407 | const run = executionContext?.run; |
| 408 | const runAtCursor = () => { |
| 409 | if ( |
| 410 | !run || |
| 411 | !queryEditor || |
| 412 | !queryEditor.operations || |
| 413 | !queryEditor.hasFocus() |
| 414 | ) { |
| 415 | run?.(); |
| 416 | return; |
| 417 | } |
| 418 | |
| 419 | const cursorIndex = queryEditor.indexFromPos(queryEditor.getCursor()); |
| 420 | |
| 421 | // Loop through all operations to see if one contains the cursor. |
| 422 | let operationName: string | undefined; |
| 423 | for (const operation of queryEditor.operations) { |
| 424 | if ( |
| 425 | operation.loc && |
| 426 | operation.loc.start <= cursorIndex && |
| 427 | operation.loc.end >= cursorIndex |
| 428 | ) { |
| 429 | operationName = operation.name?.value; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | if (operationName && operationName !== queryEditor.operationName) { |
| 434 | setOperationName(operationName); |
| 435 | } |
| 436 | |
| 437 | run(); |
| 438 | }; |
| 439 | |
| 440 | useKeyMap(queryEditor, ['Cmd-Enter', 'Ctrl-Enter'], runAtCursor); |
| 441 | useKeyMap(queryEditor, ['Shift-Ctrl-C'], copy); |
nothing calls this directly
no test coverage detected