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

Support library for custom diagram layout #45

Open
bnorm opened this issue May 23, 2021 · 0 comments
Open

Support library for custom diagram layout #45

bnorm opened this issue May 23, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@bnorm
Copy link
Owner

bnorm commented May 23, 2021

Currently the layout for the function call diagram is hardcoded in the plugin. This means that users of this compiler plugin have no way to customize the look of the diagram if they want. Could there be a support library that includes common types which are recognized by the compiler plugin and allow passing of the components of the diagram rather than the diagram itself?

For example, consider the following types:

class CallDiagram(
  val file: String,
  val line: Long,
  val text: String,
  val parameters: List<CallParameter?>
)

class CallParameter(
  val offset: Int,
  val value: Any?
)

If provided and recognized by the compiler plugin, this type could serve as a replacement for a String message parameter and allow the called function to print, log, or whatever it wants with the resulting diagram. This could aid in creating a more rich assertion diagram or narrowing the scope of the diagram to only the needed information.

fun <T> dbg(value: T): T

// A call to the above function would be replaced with a call to the function below

fun <T> dbg(value: T, diagram: CallDiagram): T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant