Comments (5)
Hi @swiftyfinch.
Thanks for being an xcbeautify user, and sorry for the delayed response!
I internalized OutputType, since I wanted this to be an implementation detail, similar to most of the other types.
In the future, my intention has been to simply read a string and output an optional (formatted) string via Xcbeauitier.
Recently, I introduced a protocol called OutputRendering. Its concrete types are meant to be custom formatters, and I think that might address your use case.
Have you looked into this, and what do you think about creating one to solve this issue?
I’d like to avoid re-exposing other types as public, since it’ll slow down some of the otherwise breaking changes I’ve been planning to make, but I’m open to other ideas.
Let me know what you think, and we can find a way to continue supporting your use case.
from xcbeautify.
@cpisciotta Oh, I see.
I will give it a try when I have some free time.
Thank you for the suggestion!
from xcbeautify.
@swiftyfinch No problem! Let me know how I can help.
from xcbeautify.
@cpisciotta I'm sorry, I'm not sure I understand what you mean.
Do you want to open OutputRendering
protocol?
If so, it would look like this:
public protocol OutputRendering { ... }
public enum Renderer: String {
...
/// Any custom render
case custom(OutputRendering)
}
XCBeautifier(renderer: .custom(MyRender())).format(line: "something")
And then, any user can provide a custom render.
This is not as simple as just opening OutputType
, but it is quite flexible.
However, there is a downside - it requires opening a lot of *Capture
types and their properties in order to allow for custom renders. For example, ErrorCaptureGroup
.
public protocol ErrorCaptureGroup: CaptureGroup {
var wholeError: String { get }
}
struct MyRender: OutputRendering {
func formatError(group: ErrorCaptureGroup) -> String {
let errorMessage = group.wholeError
return ... // custom implementation
}
}
Did I understand you correctly?
from xcbeautify.
@swiftyfinch Not quite. I am asking if you'd be open to implementing a "Rugby-style" formatter directly in the xcbeautify project. It would obviously be consumed by Rugby, but because it'd be in the project, it could be used by others too.
from xcbeautify.
Related Issues (20)
- Replace Renovate with Dependabot
- Treat Warnings as Errors
- Add Code Coverage Check
- Introduce a Configuration File
- Build Against Multiple Swift Versions
- Introduce ParserTests
- Resolve GHA Warnings in Release Workflow
- Add End-to-End Tests
- [New Output] Build Timing Summary HOT 1
- Support showing failing tests only HOT 2
- Exit Early on Empty Lines
- Regex of CompileWarning will be mismatched some other warnings. HOT 1
- Huge memory allocation with a big log file. HOT 2
- Summarize errors and warnings after filtered log output? HOT 1
- Homebrew surfacing a v2.0.0 that isn't on the releases page? HOT 2
- feat: option to ignore warnings HOT 1
- Enforce Minimum xcbeautify Version
- Add Version Logging HOT 1
- Cannot set environment variable NO_COLOR HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xcbeautify.