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

常用格式化功能支持 #2

Open
rootkiter opened this issue Nov 23, 2021 · 0 comments
Open

常用格式化功能支持 #2

rootkiter opened this issue Nov 23, 2021 · 0 comments

Comments

@rootkiter
Copy link
Owner

rootkiter commented Nov 23, 2021

在写代码的时候,会经常遇到数据结构内元素无法对齐的情况,让代码看起来有点乱。。需要一个可以格式化常用结构的插件。比如,列表,元组,字典,等常见数据结构的内部展示,一个预估样例为:

["12cbf5e90d92806bcdc2260527e85fa0","0xc67c","arm","32","le"],
["4b713ac4ca6646c7941e609e770f8dc8","0x40239e","x8664","64","le"],
["0b5e05bd8c4acd10b570839ae5dcfae7","0x1bdd4","arm","32","le"],

格式化为

["12cbf5e90d92806bcdc2260527e85fa0","0xc67c"  ,"arm"  ,"32","le"],
["4b713ac4ca6646c7941e609e770f8dc8","0x40239e","x8664","64","le"],
["0b5e05bd8c4acd10b570839ae5dcfae7","0x1bdd4" ,"arm"  ,"32","le"],

实现逻辑:分析多个选中的行中,每个成员的字符长度,并以列为单位,选择最长的元素作为当前列的长度。每一列长度确定后,按照列长度分别格式化每个行。

暂定:元素间隔用 ,[]{}() 等界定符 作为区分依据,以便保证元素类型可以兼容数字和字串。如有其他更好的实现思路也可以一并加入考量。

暂定: 先不考虑元素嵌套的每行元素个数不同的情况,以相同元素个数为默认选项。

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

No branches or pull requests

1 participant