Toggle line comments in the code editor with Ctrl+/
メンテナーはふだん 1 日以内に返信
評価
この 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:
-
Ctrl+/ or Cmd+/ with a caret comments the current line, and the same chord again uncomments it.
-
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.
-
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.
-
Blank lines are left alone, and the selection still covers the same text afterwards.
-
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
- スター
- 144
- フォーク
- 41
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 95
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sysprog21/codetrial のほかの issue
-
Progress difficulty filter lists Hard before Medium対応中かも @Pandamachi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
sysprog21/codetrial#281 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Highlight the active line in the code editor対応中かも @ArthurArthurArthur0817 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
sysprog21/codetrial#247 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Visualize attempt score trends in the progress view対応中かも @onepch が 1 日前に担当しました。 オープン
sysprog21/codetrial#275 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Whiteboard pen swatches are named by hex code and do not expose which one is selected対応中かも @LeafYeh1 が今日担当しました。 オープン
sysprog21/codetrial#274 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
enhancement help wanted
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
sysprog21/codetrial#270 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
sysprog21/codetrial の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
swc-project/swc#12516 ·
メンテナーはふだん 1 日以内に返信
-
app bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
mls-rs-crypto-awslc: exact aws-lc-rs =1.16.3 pin blocks rustls security update対応中かも @muscariello が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
[work-item] adam-adae-worsening-emergence: conform spec.yaml to the specification style contract (REQ-1280)対応中かも @muse-yamaa-bot が今日担当しました。 オープンwork-item
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信