提交 cd571e7f 编写于 作者: J Johannes Rieken

better (the same we already have) binary file error

上级 22d78300
......@@ -26,6 +26,7 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/res
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { maxBufferLen, detectMimeAndEncodingFromBuffer } from 'vs/base/node/mime';
import { MIME_BINARY } from 'vs/base/common/mime';
import { localize } from 'vs/nls';
function toIFileStat(provider: IFileSystemProvider, tuple: [URI, IStat], recurse?: (tuple: [URI, IStat]) => boolean): TPromise<IFileStat> {
const [resource, stat] = tuple;
......@@ -237,7 +238,10 @@ export class RemoteFileService extends FileService {
}).then(detected => {
if (options.acceptTextOnly && detected.mimes.indexOf(MIME_BINARY) >= 0) {
throw new Error('binary');
return TPromise.wrapError<IStreamContent>(new FileOperationError(
localize('fileBinaryError', "File seems to be binary and cannot be opened as text"),
FileOperationResult.FILE_IS_BINARY
));
}
let preferredEncoding: string;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册