prettier / prettier/plugin-php
Add option to define a minimal indentation
未关闭
还没有人认领这个 Issue。
- 主要语言
- PHP
- 星标
- 1.9k
- 派生
- 139
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi 👋
I don't know if many people would be interested, I think it would be nice to have an option to define a minimal indentation. like :
--minimal-tab-indent: <Number> (default = 0)
Who, according to --tab-width and --use-tabs would give :
Input:
<?php
array_map(function($arg1,$arg2) use ( $var1, $var2 ) {
return $arg1+$arg2/($var+$var2);
}, array("complex"=>"code","with"=>
function() {return "inconsistent";}
,"formatting"=>"is", "hard" => "to", "maintain"=>true));
Output:
// With --tab-width=4, --use-tabs=false and --minimal-tab-indent=1
<?php
array_map(
function ($arg1, $arg2) use ($var1, $var2) {
return $arg1 + $arg2 / ($var + $var2);
},
[
"complex" => "code",
"with" => function () {
return "inconsistent";
},
"formatting" => "is",
"hard" => "to",
"maintain" => true,
]
);
I know it's a really marginal addition but it makes me anxious not to have this indentation that I always use in all my projects 😭
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先确定 plugin-php 如何处理 --tab-width 和 --use-tabs,然后格式化 issue 中的 PHP 示例,以了解当前的缩进行为。在相关的制表符宽度和制表符使用设置下,定义并记录一个输出与所请求示例匹配的最小缩进选项,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100