Microsoft/TypeScript

Go-to-definition on `continue` and `break` should jump around(?) corresponding statement

Open

#51,224 建立於 2022年10月19日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
Effort: CasualExperience EnhancementHelp WantedIn Discussion

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

Similar to #51222 and #51223.

/*END*/while (true) {
  if (Math.random()) /*START*/break;
}
/*END1*/label: while (true) {
  while (true) {
    if (Math.random()) /*START*/break label;
  }
}
/*END2*/
/*END1*/while (true) {
  if (Math.random()) /*START*/continue;
}
/*END2*/
/*END1*/switch (Math.random() < 0.5) {
  case true: /*START*/break;
}
/*END2*/

Given how go-to-definition on return, await, and yield might work, it's tempting to jump up to the top of the corresponding statement.

However, I could also see us jumping to wherever the break or continue itself would jump. That's a bit at odds with the original intent of go-to-definition on return since the point of that was to figure out "who owns the current return statement?"

If someone wants to send a PR and discuss more in that PR, they're welcome to.

貢獻者指南