(options = {})
| 111 | } |
| 112 | |
| 113 | export async function openReferencesTab(options = {}) { |
| 114 | const { symbolName = "", references = [] } = options; |
| 115 | |
| 116 | const tabName = `Refs: ${symbolName}`; |
| 117 | const existingFile = editorManager.getFile(tabName, "filename"); |
| 118 | if (existingFile) { |
| 119 | existingFile.makeActive(); |
| 120 | return existingFile; |
| 121 | } |
| 122 | |
| 123 | clearHighlightCache(); |
| 124 | const flatItems = await buildFlatList(references, symbolName); |
| 125 | const stats = getReferencesStats(references); |
| 126 | |
| 127 | const tabView = createReferencesTab({ symbolName, references, flatItems }); |
| 128 | |
| 129 | const file = new EditorFile(tabName, { |
| 130 | type: "terminal", |
| 131 | content: tabView.container, |
| 132 | tabIcon: "icon linkinsert_link", |
| 133 | render: true, |
| 134 | }); |
| 135 | |
| 136 | file.setCustomTitle(() => stats.text); |
| 137 | tabView.init(); |
| 138 | |
| 139 | file.on("close", () => { |
| 140 | tabView.destroy(); |
| 141 | }); |
| 142 | |
| 143 | return file; |
| 144 | } |
| 145 | |
| 146 | export default { |
| 147 | createReferencesTab, |
no test coverage detected