tcmts.cli.views

Types

View type

Server

ensureView (cb: Codebase, hash: string) => string
A definition's view file, written if it isn't there yet.
hashesOfViewFile (cb: CodebaseCore, file: string) => string[]
The definitions a view file shows: `lib/square.ts` → lib.square, `@<hash>.ts` → that hash.
rewriteViews (cb: CodebaseCore) => void
Write again the views a session's directory has (those something asked for), as its branch has them now: one whose name is gone, or names something else now, goes.
srcDir (cb: CodebaseCore) => string
Where a branch's views are (its definitions as files, for editors, debuggers and stack traces), each branch's its own, as a git worktree's checkout is: the codebase's own branch's (the one `tcm switch` checks out) in `.tcm/src`, a session's in its directory (`.tcm/sessions/<branch>/src`). This process's branch's, or the one it reads (`--branch`): nothing writes those, they're rendered.
viewFile (cb: CodebaseCore, hash: string) => string
The file a definition's view is in: by its (first) name, else by hash.
viewOf (cb: CodebaseCore, rec: DefRecord | undefined, cache: Map<string, { file: string; line: number; ins…
Where a definition reads as written, for source maps: an unsaved one in its scratch file, a stored one in its view file (written now if it isn't there yet).
viewText (cb: CodebaseCore, hashes: string[], placement?: Placement, nameAt?: ((hash: string) => string | un…
The view of these definitions (one name's: a type and a value can share it), as the editor shows it.
viewsBranchOf (cb: CodebaseCore, file: string) => string | null | undefined
Whose views a file is in, if it's a view (of whichever branch, `srcDir`): `.tcm/src` is the codebase's own branch's, `.tcm/sessions/<dir>/src` that session's (null: a session whose branch is gone).
writeAllViews (cb: CodebaseCore) => void
writeView (cb: CodebaseCore, hash: string, placement?: Placement | undefined) => { file: string; line: number…
Write a definition's view file (if it changed); where its declaration starts in it. Not for a branch only read (`--branch`): where it would be is said, and nothing written.
writeViews (cb: CodebaseCore, all?: boolean) => void
Bring this branch's views (`srcDir`) up to date with its names. The codebase's own branch has every definition's, for the editor; a session only those something asked for (a stack trace's, its language server's), each kept as it reads now. Only what changed since the last time is rewritten: the definitions the name log says changed, and what depends on them (their views spell those names, and say where they run). Everything is, the first time, after switching branches, or when the log can't say.
writeViewsConfig (cb: CodebaseCore) => void
The views' tsconfig.json, so TypeScript (in the editor) reads them as the project does: its options, #codebase (a session's views, through its directory's package.json, its own), its packages.

Shared

lineOf (text: string, offset: number) => number
viewsCurrent (cb: CodebaseCore) => boolean
Whether this branch's view files read as the branch has it now: it isn't only read (`--branch`, which writes none), and they were brought up to date at its last change. One that's there can be read rather than rendered.
viewsKey (cb: CodebaseCore) => string
The setting saying which state of the branch its views were last brought up to date with (`<branch>@<log head>`): the codebase's own branch's, or a session's.