( view: EditorView, )
| 183 | } |
| 184 | |
| 185 | export async function findAllReferencesInTab( |
| 186 | view: EditorView, |
| 187 | ): Promise<boolean> { |
| 188 | const plugin = LSPPlugin.get(view); |
| 189 | if (!plugin) { |
| 190 | const toast = (globalThis as Record<string, unknown>).toast as |
| 191 | | ((msg: string) => void) |
| 192 | | undefined; |
| 193 | toast?.("Language server not available"); |
| 194 | return false; |
| 195 | } |
| 196 | |
| 197 | try { |
| 198 | const result = await fetchReferences(view); |
| 199 | if (result === null) { |
| 200 | return false; |
| 201 | } |
| 202 | |
| 203 | if (result.references.length === 0) { |
| 204 | const toast = (globalThis as Record<string, unknown>).toast as |
| 205 | | ((msg: string) => void) |
| 206 | | undefined; |
| 207 | toast?.("No references found"); |
| 208 | return true; |
| 209 | } |
| 210 | |
| 211 | openReferencesTab({ |
| 212 | symbolName: result.symbolName, |
| 213 | references: result.references, |
| 214 | }); |
| 215 | return true; |
| 216 | } catch (error) { |
| 217 | console.error("Find references in tab failed:", error); |
| 218 | return false; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | export function closeReferencesPanel(): boolean { |
| 223 | const { hideReferencesPanel } = require("components/referencesPanel"); |
nothing calls this directly
no test coverage detected