files - add decode method (#824)

This commit is contained in:
Benjamin Pasero
2025-02-19 09:26:13 +01:00
parent c1c6484a64
commit 6600b07e5c
5 changed files with 123 additions and 37 deletions

View File

@@ -27,4 +27,21 @@ declare module 'vscode' {
*/
readonly encoding: string;
}
export interface FileSystem {
/**
* Decodes the content from a `Uint8Array` to a `string` using
* the same encoding logic that is used when opening text documents.
*
* This method will respect the user configured file encoding,
* whether encodings are guessed and BOMs (byte order marks).
*
* @param uri The URI that represents the file. This information
* is used to figure out the encoding related configuration for the file.
* @param content The content to decode as a `Uint8Array`.
* @returns A Thenable that resolves to the decoded string.
*/
decode(uri: Uri, content: Uint8Array): Thenable<string>;
}
}