release: v0.20.0

This commit is contained in:
Ralksta
2026-10-02 18:14:23 +02:00
committed by GitHub
parent 81ce886b01
commit 5f831f719a
209 changed files with 13807 additions and 803 deletions

View File

@@ -60,6 +60,19 @@ export async function fileVersion(filePath: string): Promise<string> {
}
}
/**
* Whether a save of `content` has to back up the file at `filePath` first:
* not when there is no file yet, and not when the file already holds exactly
* these bytes. A save that changes nothing used to snapshot anyway, and with
* ten backups kept per file, a few no-op saves pushed out the real ones
* (QA A-19). Only ENOENT counts as "no file"; any other failure to read it
* throws, so the save stops before it overwrites the live file (#630).
*/
export async function needsBackup(filePath: string, content: string): Promise<boolean> {
const onDisk = await fileVersion(filePath);
return onDisk !== ABSENT_VERSION && onDisk !== versionOf(content);
}
/** The file changed on disk since the editor loaded it. */
export class VersionConflictError extends Error {
constructor(readonly currentVersion: string) {