Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -12,17 +12,22 @@ export interface LanguageFilter {
language?: string;
scheme?: string;
pattern?: string | IRelativePattern;
/**
* This provider is implemented in the UI thread.
*/
hasAccessToAllModels?: boolean;
exclusive?: boolean;
}
export type LanguageSelector = string | LanguageFilter | (string | LanguageFilter)[];
export function score(selector: LanguageSelector, candidateUri: URI, candidateLanguage: string): number {
export function score(selector: LanguageSelector, candidateUri: URI, candidateLanguage: string, candidateIsSynchronized: boolean): number {
if (Array.isArray(selector)) {
// array -> take max individual value
let ret = 0;
for (const filter of selector) {
const value = score(filter, candidateUri, candidateLanguage);
const value = score(filter, candidateUri, candidateLanguage, candidateIsSynchronized);
if (value === 10) {
return value; // already at the highest
}
@@ -33,9 +38,14 @@ export function score(selector: LanguageSelector, candidateUri: URI, candidateLa
return ret;
} else if (typeof selector === 'string') {
if (!candidateIsSynchronized) {
return 0;
}
// short-hand notion, desugars to
// 'fooLang' -> [{ language: 'fooLang', scheme: 'file' }, { language: 'fooLang', scheme: 'untitled' }]
// '*' -> { language: '*', scheme: '*' }
// 'fooLang' -> { language: 'fooLang'}
// '*' -> { language: '*' }
if (selector === '*') {
return 5;
} else if (selector === candidateLanguage) {
@@ -46,7 +56,11 @@ export function score(selector: LanguageSelector, candidateUri: URI, candidateLa
} else if (selector) {
// filter -> select accordingly, use defaults for scheme
const { language, pattern, scheme } = selector;
const { language, pattern, scheme, hasAccessToAllModels } = selector;
if (!candidateIsSynchronized && !hasAccessToAllModels) {
return 0;
}
let ret = 0;