algorand / algorand/pyteal

Source Mapper Improvements: Better Options for Annotated Teal

未关闭
#657 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
new-feature-request Team Scytale
主要语言
Python
星标
288
派生
138
PR 合并指标
30 天内没有已合并 PR

描述

## 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](https://github.com/gr8h/project_rps) (this is the "Rock Paper Scissors" example from a [recent bootcamp](https://medium.com/encode-club/encode-x-algorand-bootcamp-december-2022-summary-d7daf118b8b6)), and then ran it through [YAPF](https://github.com/google/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](https://github.com/astanin/python-tabulate#automating-multilines). 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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。