未验证 提交 8af363b4 编写于 作者: K kerams 提交者: GitHub

Allow the collapsing of single line match clauses (#14248)

上级 c3a0ef22
......@@ -493,9 +493,21 @@ module Structure =
| x -> x
let synPat = getLastPat synPat
// Collapse the scope starting with `->`
let collapse = Range.endToEnd synPat.Range clause.Range
rcheck Scope.MatchClause Collapse.Same e.Range collapse
let synPatRange = synPat.Range
let resultExprRange = e.Range
// Avoid rcheck because we want to be able to collapse resultExpr even if it spans a single line
// but is not on the same one as the pattern
if synPatRange.EndLine <> resultExprRange.EndLine then
acc.Add
{
Scope = Scope.MatchClause
Collapse = Collapse.Same
Range = resultExprRange
// Collapse the scope starting with `->`
CollapseRange = Range.endToEnd synPatRange clause.Range
}
parseExpr e
and parseAttributes (Attributes attrs) =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册