Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 10x 10x 10x 10x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import * as vscode from 'vscode';
import { container } from 'tsyringe';
import { ServiceToken } from '@src/services/tokens';
import { NotSupportedError } from '@src/utilities/error';
import { WorkspaceUri } from './workspace-uri';
/**
* Provides a file system provider for the 'workspace' scheme.
*/
export class WorkspaceFileSystemProvider implements vscode.FileSystemProvider {
private _onDidChangeFile = new vscode.EventEmitter<vscode.FileChangeEvent[]>();
readonly onDidChangeFile = this._onDidChangeFile.event;
constructor() {
// Self-register with the extension context for automatic disposal
const context = container.resolve<vscode.ExtensionContext>(ServiceToken.ExtensionContext);
context.subscriptions.push(
vscode.workspace.registerFileSystemProvider(WorkspaceUri.uriScheme, this, {
isCaseSensitive: true,
isReadonly: false
})
);
}
stat(uri: vscode.Uri): vscode.FileStat | Thenable<vscode.FileStat> {
const fileUri = WorkspaceUri.toFileUri(uri);
return vscode.workspace.fs.stat(fileUri);
}
readFile(uri: vscode.Uri): Uint8Array | Thenable<Uint8Array> {
const fileUri = WorkspaceUri.toFileUri(uri);
return vscode.workspace.fs.readFile(fileUri);
}
writeFile(uri: vscode.Uri, content: Uint8Array): void | Thenable<void> {
const fileUri = WorkspaceUri.toFileUri(uri);
return vscode.workspace.fs.writeFile(fileUri, content);
}
readDirectory(): [string, vscode.FileType][] {
return [];
}
createDirectory(): void {
throw new NotSupportedError();
}
delete(): void {
throw new NotSupportedError();
}
rename(): void {
throw new NotSupportedError();
}
watch(): vscode.Disposable {
return new vscode.Disposable(() => { });
}
} |