From 6a08c28dcaad0d1f85b807d3191d128bf85c14d5 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 25 Mar 2024 03:45:24 +0100 Subject: [PATCH] Improve feedback on backroundlayer.id --- src/Models/ThemeConfig/Conversion/Validation.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Models/ThemeConfig/Conversion/Validation.ts b/src/Models/ThemeConfig/Conversion/Validation.ts index 471f8aa92..d13afe8b0 100644 --- a/src/Models/ThemeConfig/Conversion/Validation.ts +++ b/src/Models/ThemeConfig/Conversion/Validation.ts @@ -277,9 +277,11 @@ export class ValidateTheme extends DesugaringStep { backgroundId === "photo" || backgroundId === "map" || backgroundId === "osmbasedmap" if (!isCategory && !ValidateTheme._availableLayers.has(backgroundId)) { + const options = Array.from(ValidateTheme._availableLayers) + const nearby = Utils.sortedByLevenshteinDistance(backgroundId, options, t => t) context .enter("defaultBackgroundId") - .err("This layer ID is not known: " + backgroundId) + .err(`This layer ID is not known: ${backgroundId}. Perhaps you meant one of ${nearby.slice(0,5).join(", ")}`) } }