-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling query config options #9807
Comments
According to docs there are 4 settings that contain names with dots:
It looks to me like
In case of
It seems like the only settings that would need to be merged into another are to do with |
It looks like the place to merge the options would be after merging the different configs Line 195 in 8ba4ffc
We need to take care of the precedence of the configs, which is:
so we can't just overwrite the For example if we have:
The one that should take precedence is if (mergedConfig["syntaxHighlight.activated"]) {
mergedConfig.syntaxHighlight.activated = mergedConfig["syntaxHighlight.activated"]
} as the result would be: Additionally, it's possible that we could initially set |
A rough idea for setting const setSyntaxHighlight = (config) => {
if (typeof config.syntaxHighlight === "object") {
mergedConfig.syntaxHighlight = config.syntaxHighlight
} else if (config.syntaxHighlight === false) {
mergedConfig.syntaxHighlight = false
}
if (config["syntaxHighlight.activated"]!= null) {
mergedConfig.syntaxHighlight = !mergedConfig.syntaxHighlight
? { activated: config["syntaxHighlight.activated"], theme: "agate" }
: { ...mergedConfig.syntaxHighlight, activated: config["syntaxHighlight.activated"] }
}
if (config["syntaxHighlight.theme"] != null) {
mergedConfig.syntaxHighlight = !mergedConfig.syntaxHighlight
? { theme: config["syntaxHighlight.theme"], activated: true}
: { ...mergedConfig.syntaxHighlight, theme: config["syntaxHighlight.theme"] }
}
}
setSyntaxHighlight(localConfig)
setSyntaxHighlight(combinedConfig)
setSyntaxHighlight(fetchedConfig)
setSyntaxHighlight(queryConfig)
delete mergedConfig["syntaxHighlight.activated"]
delete mergedConfig["syntaxHighlight.theme"] |
We've decided that the only way to set these types of options would be through query parameters. As such, we'll only need to check for them after getting query options and then set them inside the objects by using the |
Refs #9807 --------- Co-authored-by: Vladimír Gorej <[email protected]>
Addressed in 6923111 |
Currently some configuration options can be set as
syntaxHighlight.activated
, while also settingsyntaxHighlight
, which can be an object{ "theme": "agate", "activated": true }
orfalse
.We need to investigate the behaviour of such configurations and make them consistent. For example, when getting
syntaxHighlight.activated
we should probably assume that it is actually accessing theactivated
parameter from thesyntaxHighlight
config instead of a separatesyntaxHighlight.activated
setting. Because of this, when we setsyntaxHighlight.activated
in the configs, we should actually merge it intosyntaxHighlight
.The text was updated successfully, but these errors were encountered: