forked from MapComplete/MapComplete
More fixes to studio, move error message to validation step, fix #1710
This commit is contained in:
parent
8b4544db04
commit
21563e4dc2
5 changed files with 49 additions and 22 deletions
|
@ -421,6 +421,7 @@ export class DetectNonErasedKeysInMappings extends DesugaringStep<QuestionableTa
|
|||
// No need to check the writable tags, as this cannot write
|
||||
return json
|
||||
}
|
||||
|
||||
function addAll(keys: { forEach: (f: (s: string) => void) => void }, addTo: Set<string>) {
|
||||
keys?.forEach((k) => addTo.add(k))
|
||||
}
|
||||
|
@ -1359,6 +1360,7 @@ export class PrevalidateLayer extends DesugaringStep<LayerConfigJson> {
|
|||
|
||||
export class ValidateLayerConfig extends DesugaringStep<LayerConfigJson> {
|
||||
private readonly validator: ValidateLayer
|
||||
|
||||
constructor(
|
||||
path: string,
|
||||
isBuiltin: boolean,
|
||||
|
@ -1385,6 +1387,7 @@ export class ValidateLayerConfig extends DesugaringStep<LayerConfigJson> {
|
|||
return prepared?.raw
|
||||
}
|
||||
}
|
||||
|
||||
export class ValidateLayer extends Conversion<
|
||||
LayerConfigJson,
|
||||
{ parsed: LayerConfig; raw: LayerConfigJson }
|
||||
|
@ -1462,6 +1465,19 @@ export class ValidateLayer extends Conversion<
|
|||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < json.presets.length; i++) {
|
||||
const preset = json.presets[i]
|
||||
if (
|
||||
preset.snapToLayer === undefined &&
|
||||
preset.maxSnapDistance !== undefined &&
|
||||
preset.maxSnapDistance !== null
|
||||
) {
|
||||
context
|
||||
.enters("presets", i, "maxSnapDistance")
|
||||
.err("A maxSnapDistance is given, but there is no layer given to snap to")
|
||||
}
|
||||
}
|
||||
|
||||
return { raw: json, parsed: layerConfig }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue