本文整理汇总了TypeScript中vs/base/node/encoding.encodingExists函数的典型用法代码示例。如果您正苦于以下问题:TypeScript encodingExists函数的具体用法?TypeScript encodingExists怎么用?TypeScript encodingExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encodingExists函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('resolve terminal encoding (environment)', async function () {
process.env['VSCODE_CLI_ENCODING'] = 'utf16le';
const enc = await encoding.resolveTerminalEncoding();
assert.ok(encoding.encodingExists(enc));
assert.equal(enc, 'utf16le');
});
示例2: constructor
constructor(config: IRawSearch, walker: FileWalker) {
this.rootFolders = config.rootFolders;
this.extraFiles = config.extraFiles;
this.walker = walker;
this.contentPattern = strings.createRegExp(config.contentPattern.pattern, config.contentPattern.isRegExp, config.contentPattern.isCaseSensitive, config.contentPattern.isWordMatch, true);
this.isCanceled = false;
this.limitReached = false;
this.maxResults = config.maxResults;
this.worked = 0;
this.total = 0;
this.fileEncoding = encodingExists(config.fileEncoding) ? config.fileEncoding : UTF8;
}
示例3: getEncodingForResource
private getEncodingForResource(resource: uri, preferredEncoding?: string): string {
let fileEncoding: string;
const override = this.getEncodingOverride(resource);
if (override) {
fileEncoding = override; // encoding override always wins
} else if (preferredEncoding) {
fileEncoding = preferredEncoding; // preferred encoding comes second
} else {
fileEncoding = this.textResourceConfigurationService.getValue(resource, 'files.encoding'); // and last we check for settings
}
if (!fileEncoding || !encoding.encodingExists(fileEncoding)) {
fileEncoding = encoding.UTF8; // the default is UTF 8
}
return fileEncoding;
}
示例4:
return encoding.resolveTerminalEncoding().then(enc => {
assert.ok(encoding.encodingExists(enc));
assert.equal(enc, 'utf16le');
});
示例5:
encoding.resolveTerminalEncoding().then(encoding => {
assert.ok(encodingExists(encoding));
assert.equal(encoding, 'utf16le');
done();
}, done);