forked from MapComplete/MapComplete
Merge branch 'develop' into sauna
This commit is contained in:
commit
70a6808b5e
13 changed files with 27 additions and 19 deletions
|
|
@ -111,8 +111,7 @@ export class MenuState {
|
|||
"No tagRendering with id '" + highlightTagRendering + "'; maybe you meant:",
|
||||
Utils.sortedByLevenshteinDistance(
|
||||
highlightTagRendering,
|
||||
UserRelatedState.availableUserSettingsIds,
|
||||
(x) => x
|
||||
UserRelatedState.availableUserSettingsIds
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,8 +259,7 @@ export class ExpandFilter extends DesugaringStep<LayerConfigJson> {
|
|||
if (found === undefined) {
|
||||
const suggestions = Utils.sortedByLevenshteinDistance(
|
||||
filter,
|
||||
Array.from(ExpandFilter.predefinedFilters.keys()),
|
||||
(t) => t
|
||||
Array.from(ExpandFilter.predefinedFilters.keys())
|
||||
)
|
||||
context
|
||||
.enter(filter)
|
||||
|
|
|
|||
|
|
@ -387,8 +387,7 @@ export class ExpandTagRendering extends Conversion<
|
|||
if (layer === undefined) {
|
||||
const candidates = Utils.sortedByLevenshteinDistance(
|
||||
layerName,
|
||||
Utils.NoNull(Array.from(state.sharedLayers.keys())),
|
||||
(s) => s
|
||||
Utils.NoNull(Array.from(state.sharedLayers.keys()))
|
||||
)
|
||||
if (candidates.length === 0) {
|
||||
ctx.err(
|
||||
|
|
@ -419,7 +418,7 @@ export class ExpandTagRendering extends Conversion<
|
|||
)
|
||||
}
|
||||
|
||||
candidates = Utils.sortedByLevenshteinDistance(name, candidates, (i) => i)
|
||||
candidates = Utils.sortedByLevenshteinDistance(name, candidates)
|
||||
ctx.err(
|
||||
"The tagRendering with identifier " +
|
||||
name +
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ class SubstituteLayer extends Conversion<string | LayerConfigJson, LayerConfigJs
|
|||
for (const name of names) {
|
||||
const found = Utils.Clone(state.sharedLayers.get(name))
|
||||
if (found === undefined) {
|
||||
context.err("Layer with name " + name + " not found")
|
||||
const nearbyNames = Utils.sortedByLevenshteinDistance(name, Array.from(state.sharedLayers.keys()))
|
||||
context.err("Layer with name " + name + " not found. Dit you mean one of "+nearbyNames.slice(0, 3))
|
||||
continue
|
||||
}
|
||||
found["_basedOn"] = name
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export class ValidateTheme extends DesugaringStep<ThemeConfigJson> {
|
|||
)
|
||||
const available = new Set(knownIds)
|
||||
if (!isCategory && !available.has(backgroundId)) {
|
||||
const nearby = Utils.sortedByLevenshteinDistance(backgroundId, knownIds, (t) => t)
|
||||
const nearby = Utils.sortedByLevenshteinDistance(backgroundId, knownIds)
|
||||
context
|
||||
.enter("defaultBackgroundId")
|
||||
.err(
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ export default class FilterConfig {
|
|||
if (Validators.availableTypes.indexOf(type) < 0) {
|
||||
throw `Invalid filter: type is not a valid validator. Did you mean one of ${Utils.sortedByLevenshteinDistance(
|
||||
type,
|
||||
<ReadonlyArray<string>>Validators.availableTypes,
|
||||
(x) => x
|
||||
<ReadonlyArray<string>>Validators.availableTypes
|
||||
).slice(0, 3)}`
|
||||
}
|
||||
// Type is validated against 'ValidatedTextField' in Validation.ts, in ValidateFilterConfig
|
||||
|
|
|
|||
|
|
@ -212,8 +212,7 @@ export default class TagRenderingConfig {
|
|||
json.freeform.type
|
||||
}, perhaps you meant ${Utils.sortedByLevenshteinDistance(
|
||||
json.freeform.key,
|
||||
<any>Validators.availableTypes,
|
||||
(s) => <any>s
|
||||
Validators.availableTypes
|
||||
)}. See https://source.mapcomplete.org/MapComplete/MapComplete/src/branch/develop/Docs/SpecialInputElements.md for more information`
|
||||
}
|
||||
const type: ValidatorType = <any>json.freeform.type ?? "string"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue