MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / findAllReferencesInTab

Function findAllReferencesInTab

src/cm/lsp/references.ts:185–220  ·  view source on GitHub ↗
(
	view: EditorView,
)

Source from the content-addressed store, hash-verified

183}
184
185export 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
222export function closeReferencesPanel(): boolean {
223 const { hideReferencesPanel } = require("components/referencesPanel");

Callers

nothing calls this directly

Calls 4

openReferencesTabFunction · 0.90
fetchReferencesFunction · 0.85
getMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected