Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Toggle line comments in the code editor with Ctrl+/

已关闭
#273 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@henrylee1003 已经在做这个了。

开始于 2026年10月11日。

  • #278 来自 @henrylee1003 —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

A candidate writing code in the interview editor has no shortcut to comment lines out. Ctrl+/ (Cmd+/ on macOS) does nothing in the editor today, because the editor is a plain <textarea> and web/interview.js handles only Tab, Escape and Ctrl+Enter on it.

This comes up while debugging during the Test step of REACTO: the candidate wants to disable a few lines, run the tests, and bring the lines back. The present workaround is to type # or // at the start of each line by hand and delete them again afterwards, one line at a time, while the interview clock runs.

Proposed behavior, matching what VS Code and the LeetCode editor do:

  1. Ctrl+/ or Cmd+/ with a caret comments the current line, and the same chord again uncomments it.

  2. With a selection it toggles every line the selection touches. If every non-blank line is already commented, the comment markers are removed; otherwise one is added to each non-blank line.

  3. The marker is # for Python and // for JavaScript, C, C++ and Java, followed by one space, and is placed at the smallest indentation among the affected lines so the block stays aligned.

  4. Blank lines are left alone, and the selection still covers the same text afterwards.

  5. The edit goes through the same path as the existing Tab indent, so undo restores it in one step.

Scope: a pure function in web/editor.js beside indentSelection, a keydown branch in web/interview.js, and cases in tests/browser/editor.test.js. Block comments (/* */) are out of scope.

One open question for a maintainer: the limited editor mode from #252 lets a session turn off auto-indent and bracket auto-close. Should this shortcut follow one of those options, get its own, or stay always on? I would default to always on, since it changes nothing unless the candidate presses the chord.

I checked open and closed issues for "toggle comment", "comment shortcut" and "Ctrl+/" and found no existing thread. I have read web/editor.js and the editor tests and would like to work on this; Could I work on it if the behavior above is acceptable.

主要语言
Rust
星标
160
派生
64
平均合并
1 天 9 小时
30 天内合并 PR
114

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sysprog21/codetrial 的其他 Issue

查看 sysprog21/codetrial 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。