1
>
/*---------------------------------------------------------------------------------------------
languageSelector.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { IRelativePattern, match as matchGlobPattern } from '../../base/common/glob.js';
7
>
import { URI } from '../../base/common/uri.js';
8
>
import { normalize } from '../../base/common/path.js';
9
>
10
>
export interface LanguageFilter {
11
>
readonly language?: string;
12
>
readonly scheme?: string;
13
>
readonly pattern?: string | IRelativePattern;
14
>
readonly notebookType?: string;
15
>
/**
16
>
* This provider is implemented in the UI thread.
17
>
*/
18
>
readonly hasAccessToAllModels?: boolean;
19
>
readonly exclusive?: boolean;
20
>
21
>
/**
22
>
* This provider comes from a builtin extension.
23
>
*/
24
>
readonly isBuiltin?: boolean;
25
>
}
26
>
27
>
export type LanguageSelector = string | LanguageFilter | ReadonlyArray<string | LanguageFilter>;
28
>
29
>
export function score(selector: LanguageSelector | undefined, candidateUri: URI, candidateLanguage: string, candidateIsSynchronized: boolean, candidateNotebookUri: URI | undefined, candidateNotebookType: string | undefined): number {
30
31
if (Array.isArray(selector)) {