半角長音符の優先設定と番号の半角区切り候補を追加する - #365
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
候補更新のホットパスで不要なSet生成が常時発生しうる点と、設定ラベル/READMEの用語が実際の挙動(単独長音符)と齟齬になりうる点を修正したいです。
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
単独の長音符「ー」を変換する際に半角「ー」を優先候補として提示できる設定を追加し、あわせて英数字+区切り記号だけで構成される文字列(郵便番号・電話番号・ID等)に対して区切りの半角候補(ー / -)を追加する変更です。入力体験(候補提示・選択・確定)と設定UI、およびCoreのテストで機能を担保する位置づけになっています。
Changes:
- 単独長音符のときに半角「ー」を優先候補にする設定(Config/UI/候補生成)を追加
- 英数字+区切りのみの読み(例:
457ー0067)に457ー0067/457-0067の候補を追加 - 上記の挙動を検証するCoreテスト群を追加
File summaries
| File | Description |
|---|---|
| README.md | 新機能(単独長音符の半角優先・英数字コードの区切り候補)を説明として追記 |
| Core/Tests/CoreTests/InputUtilsTests/SegmentsManagerLongVowelMarkTests.swift | 単独長音符の候補提示・確定・キャンセル等のテストを追加 |
| Core/Tests/CoreTests/InputUtilsTests/HyphenatedCodeConversionTests.swift | 郵便番号/電話番号/コードの区切り候補が提示・選択できることを統合テスト |
| Core/Tests/CoreTests/InputUtilsTests/HyphenatedCodeCandidatesTests.swift | 区切り候補生成ロジックの単体テストを追加 |
| Core/Sources/Core/InputUtils/SegmentsManager.swift | 変換候補生成に「単独長音符の優先候補」+「区切り候補」を挿入 |
| Core/Sources/Core/InputUtils/HyphenatedCodeCandidates.swift | 英数字+区切りのみの読みから区切り表記ゆれ候補を生成するロジックを追加 |
| Core/Sources/Core/Configs/BoolConfigItem.swift | 新しいBool設定 TypeHalfWidthLongVowelMark を追加 |
| Core/Sources/ConverterServer/ConverterServer+Settings.swift | 設定ディスクリプタの公開と更新処理に新設定を追加 |
| azooKeyMac/Windows/ConfigWindow.swift | macOS設定画面の「入力オプション」に新設定を追加 |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let codeVariants = HyphenatedCodeCandidates.variants(for: self.composingText.convertTarget) | ||
| let codeTexts = Set(result.mainResults.map(\.text)) | ||
| let codeCandidates = codeVariants.filter { !codeTexts.contains($0) }.map { text in | ||
| Candidate( | ||
| text: text, value: -18, | ||
| composingCount: .surfaceCount(self.composingText.convertTarget.count), | ||
| lastMid: MIDData.一般.mid, | ||
| data: [.init(word: text, ruby: self.composingText.convertTarget, cid: CIDData.記号.cid, mid: MIDData.一般.mid, value: -18)], | ||
| isLearningTarget: false | ||
| ) | ||
| } | ||
| result.mainResults.insert(contentsOf: codeCandidates, at: min(5, result.mainResults.count)) |
| ), | ||
| descriptor( | ||
| key: Config.TypeHalfWidthLongVowelMark.key, | ||
| title: "ハイフンは半角を入力", |
| ### ハイフンを半角で入力 | ||
|
|
||
| 設定の「カスタマイズ」→「入力オプション」で「ハイフンは半角を入力」をオンにすると、 | ||
| 日本語入力で単独の長音符を変換したときに、半角の `ー` を第一候補として表示します。全角の `ー` も選べます。 | ||
| 例えばローマ字入力の `-` キーが対象です。キーを押した時点では確定せず、通常どおり未確定の文字列を変換して確定します。 |
|
このようなspecificな設定を追加するのは避けたいのでクローズします |
単独の長音符を変換するときに半角「ー」を優先する設定を追加します。即確定はせず全角も選択できます。また、457ー0067など英数字と区切りだけの入力に457ー0067と457-0067を追加します。
検証
設定オン/オフ・語中の除外・番号候補の選択と全体確定をテスト。
このブランチ単独で
swift test --package-path Core --jobs 4を実行し、Coreの87テストが成功しました。git diff --checkも成功しています。変換範囲と処理負荷
番号候補がない入力では重複チェックを行わず、文節編集中は全入力向けの番号候補を追加しません。設定名の「ハイフン」は入力キーの呼称として維持し、対象文字が半角長音符
ー(U+FF70)であることをREADMEに明記しました。