Skip to content

Commit

Permalink
fixup! fix #7269: complete support vscode.workspace.fs API
Browse files Browse the repository at this point in the history
  • Loading branch information
akosyakov committed Jul 27, 2020
1 parent f5e30cc commit 152d5b8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/filesystem/src/browser/filesystem-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ import { FileService, FileServiceContribution } from './file-service';
import { RemoteFileSystemProvider, RemoteFileSystemServer, remoteFileSystemPath, RemoteFileSystemProxyFactory } from '../common/remote-file-system-provider';
import { FileSystem, FileStat, FileMoveOptions, FileDeleteOptions, FileSystemError } from '../common/filesystem';
import URI from '@theia/core/lib/common/uri';
import { FileOperationError, FileOperationResult, BaseStatWithMetadata, FileStatWithMetadata } from '../common/files';
import { FileOperationError, FileOperationResult, BaseStatWithMetadata, FileStatWithMetadata, etag } from '../common/files';
import { TextDocumentContentChangeEvent } from 'vscode-languageserver-protocol';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
import { RemoteFileServiceContribution } from './remote-file-service-contribution';
import { UTF8 } from '@theia/core/src/common/encodings';

export default new ContainerModule(bind => {
bindFileSystemPreferences(bind);
Expand Down Expand Up @@ -115,11 +116,22 @@ export default new ContainerModule(bind => {
rethrowError(file.uri, e);
}
}
updateContent(file: FileStat, contentChanges: TextDocumentContentChangeEvent[], options?: {
async updateContent(file: FileStat, contentChanges: TextDocumentContentChangeEvent[], options?: {
encoding?: string | undefined;
overwriteEncoding?: string | undefined;
} | undefined): Promise<FileStat> {
throw new Error('Method not implemented.');
try {
const result = await fileService.update(new URI(file.uri), contentChanges, {
mtime: file.lastModification,
etag: etag({ size: file.size, mtime: file.lastModification }),
readEncoding: options?.encoding || UTF8,
encoding: options?.overwriteEncoding,
overwriteEncoding: !!options?.overwriteEncoding
});
return convertStat(result);
} catch (e) {
rethrowError(file.uri, e);
}
}
async move(sourceUri: string, targetUri: string, options?: FileMoveOptions | undefined): Promise<FileStat> {
try {
Expand Down

0 comments on commit 152d5b8

Please sign in to comment.