analyzedScratch
The scratch file abs analyzed as it holds text (in this process, as the language server analyzes it), or as it
was last if nothing's changed since: the text, or the codebase.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import type { Analysis } from "#codebase/tcmts/core/analyze"; import { scratchAnalyses } from "#codebase/tcmts/studio"; export function analyzedScratch(cb: Codebase, abs: string, text: string): Analysis { const key = `${cb.store.head()}\0${text}`; const kept = scratchAnalyses.get(abs); if (kept?.key === key) return kept.a; cb.refreshShim(); const a = cb.analyze(abs, cb.scratchSalts(), [], new Map([[abs, text]])); scratchAnalyses.set(abs, { key, a }); return a; }
uses
used by
- tcmts.studio.completeInScratch
- tcmts.studio.definitionInScratch
- tcmts.studio.evaluateInScratch
- tcmts.studio.extractInScratch
- tcmts.studio.hoverInScratch
- tcmts.studio.previewInScratch
- tcmts.studio.pullIntoScratch
- tcmts.studio.referencesInScratch
- tcmts.studio.renameInScratch
- tcmts.studio.runScratch
- tcmts.studio.runTestInScratch
- tcmts.studio.saveScratch
- tcmts.studio.signatureInScratch