Support case-insensitive value providers

This commit is contained in:
Josh Gross
2023-03-08 15:52:33 -05:00
parent 43bc333064
commit e557ccc567
4 changed files with 68 additions and 2 deletions
+3 -2
View File
@@ -130,10 +130,11 @@ async function additionalValidations(
if (valueProvider) {
const customValues = await valueProvider.get(getProviderContext(documentUri, template, root, token));
const customValuesMap = new Set(customValues.map(x => x.label));
const caseInsensitive = valueProvider.caseInsensitive ?? false;
const customValuesMap = new Set(customValues.map(x => (caseInsensitive ? x.label.toLowerCase() : x.label)));
if (isString(token)) {
if (!customValuesMap.has(token.value)) {
if (!customValuesMap.has(caseInsensitive ? token.value.toLowerCase() : token.value)) {
invalidValue(diagnostics, token, valueProvider.kind);
}
}