(result: CommandPaletteResult)
| 1450 | } |
| 1451 | |
| 1452 | async function openResult(result: CommandPaletteResult) { |
| 1453 | const lastQuery = query.value.trim() |
| 1454 | |
| 1455 | if (result.type === 'token-suggestion') { |
| 1456 | result.run() |
| 1457 | return |
| 1458 | } |
| 1459 | |
| 1460 | closePalette() |
| 1461 | clearPalette() |
| 1462 | |
| 1463 | if (result.type === 'space') { |
| 1464 | await openSpace(result.spaceId) |
| 1465 | } |
| 1466 | else if (result.type === 'snippet') { |
| 1467 | await openSnippet(result.item) |
| 1468 | } |
| 1469 | else if (result.type === 'note') { |
| 1470 | await openNote(result.item) |
| 1471 | } |
| 1472 | else if (result.type === 'http-request') { |
| 1473 | await openHttpRequest(result.item) |
| 1474 | } |
| 1475 | else if (result.type === 'command') { |
| 1476 | await result.command.run() |
| 1477 | recordUsageResult(result, lastQuery) |
| 1478 | return |
| 1479 | } |
| 1480 | else { |
| 1481 | await openRecent(result.recent) |
| 1482 | } |
| 1483 | |
| 1484 | recordRecentResult(result) |
| 1485 | recordUsageResult(result, lastQuery) |
| 1486 | } |
| 1487 | |
| 1488 | useEventListener(window, 'keydown', (event) => { |
| 1489 | if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'p') { |
nothing calls this directly
no test coverage detected