Skip to content
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

feat:: configurable formatter #565

Merged
merged 9 commits into from
Nov 10, 2020
Merged

Conversation

fwal
Copy link
Contributor

@fwal fwal commented Nov 9, 2020

Hi! 👋

This is a proposal on how to enable customisation of the formatting step by adding the ability to add additional formatters programatically. In the example included in the test, a function type is formatted as a custom object defined by the consumer.

Example:

createFormatter(configuration, (formatter) => {
    formatter.addTypeFormatter(new MyFunctionTypeFormatter())
})

I'm looking forward to your feedback!

Copy link
Member

@domoritz domoritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. Just one comment about naming.

Can you also add documentation and maybe an example to the readme?

factory/formatter.ts Outdated Show resolved Hide resolved
@fwal
Copy link
Contributor Author

fwal commented Nov 10, 2020

I've added an example but having a bit of struggle with the naming of the configuration function (naming is one of the hardest parts with programming after all 😄) so I'll have to get back to you on that.

@domoritz
Copy link
Member

domoritz commented Nov 10, 2020

Thank you for the docs. Yes, naming is hard. Maybe augment or augmentor?

@fwal
Copy link
Contributor Author

fwal commented Nov 10, 2020

Yeah that works, changed to FormatterAugmentor.

README.md Outdated Show resolved Hide resolved
factory/formatter.ts Outdated Show resolved Hide resolved
factory/formatter.ts Outdated Show resolved Hide resolved
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
test/config.test.ts Outdated Show resolved Hide resolved
test/config.test.ts Outdated Show resolved Hide resolved
test/config.test.ts Outdated Show resolved Hide resolved
@domoritz domoritz changed the title Configurable formatter feat:: configurable formatter Nov 10, 2020
@domoritz domoritz merged commit a3479e0 into vega:master Nov 10, 2020
@fwal fwal deleted the configurable-formatter branch November 10, 2020 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants