本文整理汇总了TypeScript中vs/editor/common/modes/languageSelector.score函数的典型用法代码示例。如果您正苦于以下问题:TypeScript score函数的具体用法?TypeScript score怎么用?TypeScript score使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了score函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('score, any language', function () {
assert.equal(score({ language: '*' }, model.uri, model.language), 5);
assert.equal(score('*', model.uri, model.language), 5);
assert.equal(score('*', URI.parse('foo:bar'), model.language), 5);
assert.equal(score('farboo', URI.parse('foo:bar'), model.language), 10);
});
示例2: test
test('score, filter', function() {
assert.equal(score('farboo', model), 10);
assert.equal(score({ language: 'farboo'}, model), 10);
assert.equal(score({ language: 'farboo', scheme: 'file' }, model), 20);
assert.equal(score({ language: 'farboo', scheme: 'http' }, model), 0);
assert.equal(score({ pattern: '**/*.fb' }, model), 5);
// assert.equal(score({ pattern: '/testbed/file.fb' }, model), 10); fails on windows
});
示例3: test
test('Document selector match - unexpected result value #60232', function () {
let selector = {
language: 'json',
scheme: 'file',
pattern: '**/*.interface.json'
};
let value = score(selector, URI.parse('file:///C:/Users/zlhe/Desktop/test.interface.json'), 'json', true);
assert.equal(value, 10);
});