INNER CODE UNIT · TypeScript

relativeLabel

prisma/orm · apps/lsp-playground/src/client/main.ts:141

function relativeLabel(path: string, scratchRootPath: string): string {
  const prefix = scratchRootPath.endsWith('/') ? scratchRootPath : `${scratchRootPath}/`;
  return path.startsWith(prefix) ? path.slice(prefix.length) : basename(path);
}

/**
 * One scratch-project member as the client tracks it: its Monaco-facing
 * identity (`uri`/`path`), the text last known for it (the seed text until
 * its file is opened and edited, then whatever the editor model held when
 * the user last switched away), and whether `didOpen` has been sent for it
 * yet.
 *
 * A file's document opens — and `didOpen` fires — only the first time it is
 * selected; re-selecting an already-opened file only swaps the visible
 * model, never re-opens it.
 */
interface FileEntry {
  readonly uri: string;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…