I have a vscode.TextDocument and want to check if the file matches a glob.
I have a vscode.TextDocument and want to check if the file matches a glob.
const documentFilter: vscode.DocumentFilter = {
pattern: '**/*.md',
};
const matches = vscode.languages.match(documentFilter, document) !== 0;
Simple usage:
import * as vscode from 'vscode';
documentMatchGlob(doc: vscode.TextDocument, glob: string): boolean {
return vscode.languages.match({ pattern: glob }, document) !== 0;
}