Skip to content

Commit

Permalink
Rename fileContentMap to _fileContentMap for consistency and clarity …
Browse files Browse the repository at this point in the history
…in EditableFileSystemProvider
  • Loading branch information
amitjoshi committed Nov 26, 2024
1 parent 537414c commit 0f73785
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/common/utilities/EditableFileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as vscode from 'vscode';


export class EditableFileSystemProvider implements vscode.FileSystemProvider {
private fileContentMap: { [key: string]: Uint8Array } = {};
private _fileContentMap: { [key: string]: Uint8Array } = {};
private _onDidChangeEmitter = new vscode.EventEmitter<vscode.FileChangeEvent[]>();
readonly onDidChangeFile = this._onDidChangeEmitter.event;

Expand All @@ -26,19 +26,19 @@ export class EditableFileSystemProvider implements vscode.FileSystemProvider {
// Read file content
readFile(uri: vscode.Uri): Uint8Array {
const filePath = uri.path;
return this.fileContentMap[filePath] || new Uint8Array();
return this._fileContentMap[filePath] || new Uint8Array();
}

// Write file content
writeFile(uri: vscode.Uri, content: Uint8Array): void {
const filePath = uri.path;
this.fileContentMap[filePath] = content;
this._fileContentMap[filePath] = content;
this._onDidChangeEmitter.fire([{ type: vscode.FileChangeType.Changed, uri }]);
}

// Other required methods for FileSystemProvider
stat(uri: vscode.Uri): vscode.FileStat {
return { type: vscode.FileType.File, ctime: Date.now(), mtime: Date.now(), size: this.fileContentMap[uri.path]?.length || 0 };
return { type: vscode.FileType.File, ctime: Date.now(), mtime: Date.now(), size: this._fileContentMap[uri.path]?.length || 0 };
}

readDirectory(uri: vscode.Uri): [string, vscode.FileType][] {
Expand All @@ -59,7 +59,7 @@ export class EditableFileSystemProvider implements vscode.FileSystemProvider {
// Method to get file content as string
getFileContent(uri: vscode.Uri): string {
const filePath = uri.path;
const content = this.fileContentMap[filePath];
const content = this._fileContentMap[filePath];
return content ? Buffer.from(content).toString('utf8') : '';
}
}

0 comments on commit 0f73785

Please sign in to comment.