()
| 12 | let hintsModification; |
| 13 | |
| 14 | export default async function findFile() { |
| 15 | palette(generateHints, onselect, strings["type filename"], () => { |
| 16 | files.off("add-file", onAddFile); |
| 17 | files.off("remove-file", onRemoveFile); |
| 18 | }); |
| 19 | |
| 20 | files.on("add-file", onAddFile); |
| 21 | files.on("remove-file", onRemoveFile); |
| 22 | |
| 23 | /** |
| 24 | * Generates hint for inputhints |
| 25 | * @param {HintModification} hints Hint modification object |
| 26 | */ |
| 27 | async function generateHints(hints) { |
| 28 | hintsModification = hints; |
| 29 | const list = []; |
| 30 | |
| 31 | editorManager.files.forEach((file) => { |
| 32 | const { uri, name } = file; |
| 33 | let { location = "" } = file; |
| 34 | |
| 35 | if (location) { |
| 36 | location = helpers.getVirtualPath(location); |
| 37 | } |
| 38 | |
| 39 | list.push(hintItem(name, location, uri)); |
| 40 | }); |
| 41 | |
| 42 | list.push(...files(hintItem)); |
| 43 | return list; |
| 44 | } |
| 45 | |
| 46 | function onselect(value) { |
| 47 | if (!value) return; |
| 48 | openFile(value); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Generates hint item for inputhints |
no test coverage detected