diff -r 0fc0ed9a3ad7 -r f32e5d4cf1a3 src/Tools/VSCode/patches/isabelle_encoding.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Tools/VSCode/patches/isabelle_encoding.patch Tue Mar 08 17:02:24 2022 +0100 @@ -0,0 +1,54 @@ +diff --git a/src/vs/workbench/services/textfile/common/encoding.ts b/src/vs/workbench/services/textfile/common/encoding.ts +--- a/src/vs/workbench/services/textfile/common/encoding.ts ++++ b/src/vs/workbench/services/textfile/common/encoding.ts +@@ -6,6 +6,7 @@ + import { Readable, ReadableStream, newWriteableStream, listenStream } from 'vs/base/common/stream'; + import { VSBuffer, VSBufferReadable, VSBufferReadableStream } from 'vs/base/common/buffer'; + import { IDisposable } from 'vs/base/common/lifecycle'; ++import * as isabelle_encoding from './isabelle_encoding'; + + export const UTF8 = 'utf8'; + export const UTF8_with_bom = 'utf8bom'; +@@ -78,7 +79,9 @@ class DecoderStream implements IDecoderStream { + */ + static async create(encoding: string): Promise { + let decoder: IDecoderStream | undefined = undefined; +- if (encoding !== UTF8) { ++ if (encoding === isabelle_encoding.ENCODING) { ++ decoder = isabelle_encoding.getDecoder(); ++ } else if (encoding !== UTF8) { + const iconv = await import('@vscode/iconv-lite-umd'); + decoder = iconv.getDecoder(toNodeEncoding(encoding)); + } else { +@@ -212,7 +215,9 @@ export function toDecodeStream(source: VSBufferReadableStream, options: IDecodeS + + export async function toEncodeReadable(readable: Readable, encoding: string, options?: { addBOM?: boolean }): Promise { + const iconv = await import('@vscode/iconv-lite-umd'); +- const encoder = iconv.getEncoder(toNodeEncoding(encoding), options); ++ const encoder = ++ encoding === isabelle_encoding.ENCODING ? ++ isabelle_encoding.getEncoder() : iconv.getEncoder(toNodeEncoding(encoding), options); + + let bytesWritten = false; + let done = false; +@@ -262,7 +267,7 @@ export async function toEncodeReadable(readable: Readable, encoding: str + export async function encodingExists(encoding: string): Promise { + const iconv = await import('@vscode/iconv-lite-umd'); + +- return iconv.encodingExists(toNodeEncoding(encoding)); ++ return encoding === isabelle_encoding.ENCODING || iconv.encodingExists(toNodeEncoding(encoding)); + } + + export function toNodeEncoding(enc: string | null): string { +@@ -479,6 +484,11 @@ export function detectEncodingFromBuffer({ buffer, bytesRead }: IReadResult, aut + } + + export const SUPPORTED_ENCODINGS: { [encoding: string]: { labelLong: string; labelShort: string; order: number; encodeOnly?: boolean; alias?: string } } = { ++ utf8isabelle: { ++ labelLong: isabelle_encoding.LABEL, ++ labelShort: isabelle_encoding.LABEL, ++ order: 0, ++ }, + utf8: { + labelLong: 'UTF-8', + labelShort: 'UTF-8',