Compute the match between a document selector and a document. Values greater than zero mean the selector matches the document.
A match is computed according to these rules:
DocumentSelector
DocumentFilter
language
"fooLang"
{ language: "fooLang" }
{}
0
scheme
pattern
*
5
10
Samples:
// default document from disk (file-scheme)doc.uri; //'file:///my/file.js'doc.languageId; // 'javascript'match('javascript', doc); // 10;match({language: 'javascript'}, doc); // 10;match({language: 'javascript', scheme: 'file'}, doc); // 10;match('*', doc); // 5match('fooLang', doc); // 0match(['fooLang', '*'], doc); // 5// virtual document, e.g. from git-indexdoc.uri; // 'git:/my/file.js'doc.languageId; // 'javascript'match('javascript', doc); // 10;match({language: 'javascript', scheme: 'git'}, doc); // 10;match('*', doc); // 5 Copy
// default document from disk (file-scheme)doc.uri; //'file:///my/file.js'doc.languageId; // 'javascript'match('javascript', doc); // 10;match({language: 'javascript'}, doc); // 10;match({language: 'javascript', scheme: 'file'}, doc); // 10;match('*', doc); // 5match('fooLang', doc); // 0match(['fooLang', '*'], doc); // 5// virtual document, e.g. from git-indexdoc.uri; // 'git:/my/file.js'doc.languageId; // 'javascript'match('javascript', doc); // 10;match({language: 'javascript', scheme: 'git'}, doc); // 10;match('*', doc); // 5
A document selector.
A text document.
A number >0 when the selector matches and 0 when the selector does not match.
>0
Compute the match between a document selector and a document. Values greater than zero mean the selector matches the document.
A match is computed according to these rules:
DocumentSelector
is an array, compute the match for each containedDocumentFilter
or language identifier and take the maximum value.language
-part of aDocumentFilter
, so"fooLang"
is like{ language: "fooLang" }
.DocumentFilter
will be matched against the document by comparing its parts with the document. The following rules apply:DocumentFilter
is empty ({}
) the result is0
scheme
,language
, orpattern
are defined but one doesn’t match, the result is0
*
gives a score of5
, matching via equality or via a glob-pattern gives a score of10
Samples: