INNER CODE UNIT · TypeScript
selectEntry
prisma/orm · apps/lsp-playground/src/client/main.ts:348
async function selectEntry(entry: FileEntry): Promise<void> {
if (entry === activeEntry) {
return;
}
if (!entry.opened) {
await openEntry(entry);
}
// Capture the outgoing entry's live edits as close to the swap as
// possible — right before `updateCodeResources`, not before the
// `openEntry` await above, so edits typed while that await was pending
// are not lost. `activeEntry` here is still the outgoing entry: this
// call is serialized (see `enqueueSelectEntry`), so nothing else can have
// reassigned it since this call started.
const outgoingEntry = activeEntry;
const outgoingModel = editorApp.getEditor()?.getModel();
if (outgoingModel !== null && outgoingModel !== undefined) {
outgoingEntry.text = outgoingModel.getValue();
}