microsoft / microsoft/TypeScript
Incorrect (potentially) indentation of function arguments spanning multiple lines
未关闭
还没有人认领这个 Issue。
Awaiting More Feedback
Domain: Formatter
Suggestion
VS Code Tracked
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 117
描述
From @nomaed on October 14, 2016 10:40
- VSCode Version: 1.6.1
- OS Version: macOS Sierra 10.12
Steps to Reproduce:
- Write a function (or a method) with several arguments (I did it with JavaScript and TypeScript files, but I believe any would work).
function myFunc(arg1, arg2, arg3, ...args) {
}
- Split arguments to several lines by hitting Enter before arguments
function myFunc(arg1,
arg2,
arg3,
...args) {
}
Auto-formatting produces this result:
function myFunc(arg1,
arg2,
arg3,
...args) {
}
I would expect to see this result instead though:
function myFunc(arg1,
arg2,
arg3,
...args) {
}
Also, when manually formatting the arguments to appear in the same column (note: this is also the default/recommended setting in tslint and maybe other linters), then further lines will start with wrong indentation:
function myFunc(arg1,
arg2,
arg3,
...args) {
console.log('huh...');
}

Copied from original issue: Microsoft/vscode#13748
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
复现 issue 中的 JavaScript 或 TypeScript 格式化案例,将自动缩进与预期的参数对齐输出以及后续的主体缩进进行比较。由于未指定源文件、测试或入口点,请先定位格式化器路径,再将两个示例的修正格式定义为完成标准。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100