提交 1236ff9d 编写于 作者: B Benjamin Pasero

Unable to change encoding for untitled files (fixes #24356)

上级 2a73b9e0
......@@ -1078,14 +1078,15 @@ export class ChangeEncodingAction extends Action {
return undefined;
}
const guessEncoding = () => {
const resource = toResource(activeEditor.input);
return this.fileService.resolveContent(resource, { autoGuessEncoding: true, acceptTextOnly: true })
.then(content => content.encoding, err => null);
};
return TPromise.timeout(50 /* quick open is sensitive to being opened so soon after another */)
.then(guessEncoding)
.then(() => {
const resource = toResource(activeEditor.input, { filter: 'file', supportSideBySide: true });
if (!resource) {
return TPromise.as(null);
}
return this.fileService.resolveContent(resource, { autoGuessEncoding: true, acceptTextOnly: true }).then(content => content.encoding, err => null);
})
.then(guessedEncoding => {
const configuration = this.configurationService.getConfiguration<IFilesConfiguration>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册