Skip to content

Source Mapper Improvements: Better Options for Annotated Teal #657

@tzaffi

Description

@tzaffi

Problem in Upcoming Source Map Feature

When source mapping is enabled and annotated teal generated, there is no mechanism to limit the width of produced lines.

For example, @bbroder-algo generated a source map for code residing in this repo (this is the "Rock Paper Scissors" example from a recent bootcamp), and then ran it through YAPF to wrap very long files, he obtained this snippet:
image

We can see that Compilation(approval_program(),... ...=True) got wrapped because it was too long.

If possible, we'd like to have handling long lines built in to the source mapper, so users don't need to each solve this problem for themselves.

Possible Solutions

  1. Use the YAPF library linked above directly, and just wrap past a certain column width
  2. The source mapper uses the tabulate package and it has a multi-line mode. We could leverage it as well to wrap columns that are too wide
  3. We could simply truncate columns that are too wide
  4. Should we try to use the black library with a very tight column width?
  5. something else?

Dependencies

#650

Urgency

Estimating: Medium. This should be reevaluated based on reception by end users.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions