-
Notifications
You must be signed in to change notification settings - Fork 7
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
refactor: New naming of Settings #284
base: master
Are you sure you want to change the base?
Conversation
@theschitz have a look at this to see if this is a plausible way forward? |
public documentationOutputIndexFile = false; | ||
public documentationOutputIndexFileDepth = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could documentation be it's own class or interface? Having the object grouped and structured similar to package.json would be nice IMO. But is it practical?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would mean to access the property it would be like this:
const settings = new Settings("my/workspace/folder");
if (settings.documentation.outputIndexFile) {
// propably output index file.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea! 👍
Will play with that later
I think it's a good thing to not rush through this change, so I think this PR will be active some time with some small changes now and then...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played a bit with this, and this approach would break the SettingsMap and SettingsLoader logic... :/
settingsMap.forEach((propertyName, settingName) => {
const configuredValue = config.get(settingName);
if (configuredValue !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(settings as any)[propertyName] = configuredValue;
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of the top of my head and a bit naive perhaps but would this work? We could also rebuild the settingsmap I guess?
settingsMap.forEach((propertyName, settingName) => {
// propertyName.split('.')[0] would be "NAB" (?)
const groupName = propertyName.split('.')[1];
propertyName = propertyName.split('.')[2];
const configuredValue = config.get(settingName);
if (configuredValue !== undefined) {
(settings as any)[groupName][settingName] = configuredValue;
}
});
- edit had a look in the code and updated the vars used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are welcome to test that out! 🙂
This is a proof of concept of how we could refactor the naming of our settings.
The first one out was a
boolean
setting. Next up is astring
settingThoughts?