Skip to content

feat(desktop): Quick Open で :行番号 入力時に指定行へジャンプ#384

Merged
MocA-Love merged 4 commits intomainfrom
feat/quick-open-line-jump
Apr 22, 2026
Merged

feat(desktop): Quick Open で :行番号 入力時に指定行へジャンプ#384
MocA-Love merged 4 commits intomainfrom
feat/quick-open-line-jump

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Apr 22, 2026

Summary

  • Cmd+P (Quick Open) で foo.ts:123foo.ts:123:45 のように入力した際、ファイルを開いた後指定行/列に自動スクロール・ジャンプする機能を追加
  • VS Code の Quick Open と同じ :line[:column] 記法に対応

変更点

  • parseQuickOpenQuery(): 入力テキストから path:line[:column] を分離する純粋関数(テスト 12 件)
  • useCommandPalette: クエリをパースし、ファイル検索はパス部分のみで実行、選択時に行/列をコールバックに渡す
  • v1 workspace: addFileViewerPaneline/column を渡すよう修正(既存の initialLine/initialColumn 機構が消費)
  • v2 workspace: FilePaneDataline/column/cursorRequestId を追加し、CodeEditorrevealPosition に接続
  • cursorRequestId は一意 ID で、同じファイルに連続で異なる行を指定した場合でも React が effect を再実行する仕組み

Test plan

  • parseQuickOpenQuery のユニットテスト 12 件(全通過)
  • 既存の renderer テスト 785 件(事前失敗 3 件は無関係)
  • 手動確認: foo.ts:42 入力 → ファイルが開き 42 行目にジャンプ
  • 手動確認: src/bar.tsx:10:5 入力 → 10 行 5 列にジャンプ
  • 手動確認: foo.ts 単独 → 従来どおりファイルを開くのみ

Closes #383

💘 Generated with Crush

Assisted-by: GLM-5 via Crush crush@charm.land

Summary by CodeRabbit

新機能

  • クイックオープン機能でファイルを開く際に、行番号と列番号を指定できるようになりました。「filename.ts:10:5」の形式で入力すると、指定された位置にカーソルが自動的に移動します。

…umn]

Closes #383.

When using Cmd+P (Quick Open), typing `foo.ts:123` or `foo.ts:123:45`
now opens the file and scrolls to the specified line/column, matching
VS Code's Quick Open behavior.

Changes:
- Extract `parseQuickOpenQuery()` to split `path:line[:col]` from user input
- Wire parsed line/column through useCommandPalette → onSelectFile →
  addFileViewerPane (v1) or openFilePane (v2)
- Extend v2 FilePaneData with line/column/cursorRequestId fields
- Add revealPosition effect in v2 CodeEditor that fires on cursorRequestId
- 12 unit tests for the parser

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 38 minutes and 51 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 38 minutes and 51 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42e482cf-7340-4a0a-b247-3d74d544ced5

📥 Commits

Reviewing files that changed from the base of the PR and between a1254cd and 50d7a6e.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/registry/views/CodeView/components/CodeEditor/CodeEditor.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/page.tsx
  • apps/desktop/src/renderer/screens/main/components/CommandPalette/index.ts
  • apps/desktop/src/renderer/screens/main/components/CommandPalette/useCommandPalette.ts
📝 Walkthrough

ウォークスルー

コマンドパレットで「ファイル:行:列」構文の解析を導入し、カーソル位置データ(行、列、cursorRequestId)をコマンドパレットからファイルペイン、ビューレンダラー、CodeView、CodeEditorコンポーネントを通じてスレッド化します。CodeEditorは要求されたカーソル位置を表示します。

変更内容

コホート / ファイル(s) 概要
クイックオープンクエリ解析
parseQuickOpenQuery.ts, parseQuickOpenQuery.test.ts
「file:line:column」構文を解析する新しいparseQuickOpenQuery関数とその包括的なテストスイートを追加。Windowsパス、負数、エッジケースに対応。
コマンドパレット統合
CommandPalette/index.ts, useCommandPalette.ts
parseQuickOpenQueryを導入し、解析されたクエリからlinecolumnを抽出してonSelectFileコールバックに渡し、ファイル検索にsearchQueryを使用。
ワークスペース・ページ層
$workspaceId/page.tsx, $workspaceId/types.ts
openFilePaneシグネチャを拡張してlocationパラメータを受け取り、FilePaneDataインターフェースにlinecolumncursorRequestIdフィールドを追加。
ファイルペイン・レジストリ
FilePane/registry/types.ts
ViewPropsインターフェースにinitialLine?: numberinitialColumn?: numbercursorRequestId?: stringを追加。
ビューレンダラー
FilePane.tsx, CodeView.tsx, CodeEditor.tsx
初期カーソル位置プロップをViewRendererからCodeEditorへスレッド化。CodeEditorにviewReady状態を追加し、エディタ初期化後にrevealPosition()を呼び出してカーソル位置を表示。

シーケンス図

sequenceDiagram
    actor User
    participant CommandPalette
    participant useCommandPalette
    participant page.tsx as Workspace Page
    participant FilePane
    participant CodeEditor
    
    User->>CommandPalette: 入力「file.ts:123:45」
    CommandPalette->>useCommandPalette: クエリ送信
    useCommandPalette->>useCommandPalette: parseQuickOpenQuery実行
    Note over useCommandPalette: searchQuery="file.ts"<br/>line=123, column=45
    useCommandPalette->>User: onSelectFile(filePath, line, column)
    User->>page.tsx: openFilePane(filePath, displayName, location)
    page.tsx->>page.tsx: cursorRequestId生成<br/>FilePaneData作成
    page.tsx->>FilePane: initialLine, initialColumn,<br/>cursorRequestId渡す
    FilePane->>CodeEditor: ViewProps経由で渡す
    CodeEditor->>CodeEditor: viewReady待機
    Note over CodeEditor: エディタ初期化完了
    CodeEditor->>CodeEditor: revealPosition(123, 45)実行
    CodeEditor->>User: カーソルを指定位置に表示
Loading

推定コード確認工数

🎯 4 (複雑) | ⏱️ 約45分

関連の可能性があるPR

ポエム

🐰 コマンドで「123へジャンプ」と言えば

ファイルはひらり、カーソル駆ける

行と列を読み取りて

エディタの目玉くるり回転〜✨

プログラマーの夢、叶いぬ🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PRのタイトル『Quick Open で :行番号 入力時に指定行へジャンプ』は、Quick Open機能に行番号ジャンプ機能を追加するという主要な変更を正確に要約しており、変更セットの主眼点を明確に示しています。
Description check ✅ Passed PRの説明は、変更内容、実装の詳細、テスト計画、関連する問題番号など、テンプレートの主要なセクションをカバーしており、変更の意図と実装内容が十分に説明されています。
Linked Issues check ✅ Passed PR#383で要件された『hogehoge.ts:123のような入力時にファイルを開き指定行まで遷移する機能』が、parseQuickOpenQuery()、useCommandPalette、FilePaneData拡張、CodeEditorのrevealPosition統合により完全に実装されています。
Out of Scope Changes check ✅ Passed すべての変更はQuick Open行番号ジャンプ機能の実装に直結しており、解析対象のコンポーネント(parseQuickOpenQuery、useCommandPalette、FilePaneData、CodeEditor)やテストファイルの追加は、PR#383の要件達成のために必要で関連性のある変更です。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/quick-open-line-jump

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…adapter

The revealPosition effect was creating a new CodeMirrorAdapter on each
fire without disposing it. Replace with direct EditorView dispatch using
EditorSelection.cursor, matching the adapter's internal implementation.

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/page.tsx (1)

241-244: crypto.randomUUID() に統一するとより簡潔かつ衝突耐性も高くなります。

同ファイル内(例: Line 437, 559, 607–608)では一意 ID 生成に crypto.randomUUID() を使っており、こちらの cursorRequestId も揃えるとコードベース全体で一貫します。

♻️ 修正案
-		const cursorRequestId =
-			location?.line !== undefined
-				? `${Date.now()}:${Math.random().toString(36).slice(2, 10)}`
-				: undefined;
+		const cursorRequestId =
+			location?.line !== undefined ? crypto.randomUUID() : undefined;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/page.tsx
around lines 241 - 244, Replace the ad-hoc ID generation for cursorRequestId
(the ternary that uses Date.now() + Math.random().toString(36).slice(...)) with
crypto.randomUUID() so it matches other usages in this file; update the
assignment where cursorRequestId is declared to return crypto.randomUUID() when
location?.line is defined and undefined otherwise, preserving the existing
conditional logic and variable name.
apps/desktop/src/renderer/screens/main/components/CommandPalette/useCommandPalette.ts (1)

18-18: 同一モジュール内からの再エクスポートは不要な可能性があります。

parseQuickOpenQueryindex.ts 経由でも再エクスポートされているとサマリにあります。useCommandPalette.ts のパブリック面に parseQuickOpenQuery を混在させると、CommandPalette フックを import する側に無関係なシンボルが露出し、インポート経路が複数になって一貫性が崩れます。テスト等での利用であれば、./parseQuickOpenQuery または ./index から直接 import する方が自然です。

♻️ 提案
-export { parseQuickOpenQuery } from "./parseQuickOpenQuery";
-
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/CommandPalette/useCommandPalette.ts`
at line 18, Remove the unnecessary re-export of parseQuickOpenQuery from
useCommandPalette.ts: delete the line exporting parseQuickOpenQuery so the
CommandPalette hook file only exposes the hook, and update any consumers to
import parseQuickOpenQuery directly from ./parseQuickOpenQuery or from the
module index.ts; this keeps useCommandPalette (the CommandPalette hook) API
focused and avoids multiple import paths.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/page.tsx:
- Around line 250-266: The update branch is overwriting an existing pane
displayName with undefined when reopening via CommandPalette; in the
state.setPaneData call (related symbols: activeData, displayName,
state.setPaneData, active.pane.id, FilePaneData) change the data assignment so
displayName uses a fallback to the existing activeData.displayName (e.g.
displayName ?? activeData.displayName) instead of writing the raw displayName,
and keep the shouldUpdateData condition as-is (or optionally ensure it still
triggers for location changes) so you don't lose previously stored display names
when displayName is undefined.

---

Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/page.tsx:
- Around line 241-244: Replace the ad-hoc ID generation for cursorRequestId (the
ternary that uses Date.now() + Math.random().toString(36).slice(...)) with
crypto.randomUUID() so it matches other usages in this file; update the
assignment where cursorRequestId is declared to return crypto.randomUUID() when
location?.line is defined and undefined otherwise, preserving the existing
conditional logic and variable name.

In
`@apps/desktop/src/renderer/screens/main/components/CommandPalette/useCommandPalette.ts`:
- Line 18: Remove the unnecessary re-export of parseQuickOpenQuery from
useCommandPalette.ts: delete the line exporting parseQuickOpenQuery so the
CommandPalette hook file only exposes the hook, and update any consumers to
import parseQuickOpenQuery directly from ./parseQuickOpenQuery or from the
module index.ts; this keeps useCommandPalette (the CommandPalette hook) API
focused and avoids multiple import paths.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8e3c0111-f0a2-4ad8-b6bd-0b69e44ff29c

📥 Commits

Reviewing files that changed from the base of the PR and between 9ffcba8 and a1254cd.

📒 Files selected for processing (10)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/FilePane.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/registry/types.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/registry/views/CodeView/CodeView.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/registry/views/CodeView/components/CodeEditor/CodeEditor.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/page.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/types.ts
  • apps/desktop/src/renderer/screens/main/components/CommandPalette/index.ts
  • apps/desktop/src/renderer/screens/main/components/CommandPalette/parseQuickOpenQuery.test.ts
  • apps/desktop/src/renderer/screens/main/components/CommandPalette/parseQuickOpenQuery.ts
  • apps/desktop/src/renderer/screens/main/components/CommandPalette/useCommandPalette.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1254cd2ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Use crypto.randomUUID() for cursorRequestId (consistent with file)
- Remove unnecessary re-export of parseQuickOpenQuery from useCommandPalette
- Preserve existing displayName when reopening via CommandPalette
- Format Math.max to single line per biome

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
index.ts was still re-exporting parseQuickOpenQuery from
useCommandPalette instead of the extracted module.

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
@MocA-Love MocA-Love merged commit d0a4389 into main Apr 22, 2026
6 checks passed
@MocA-Love MocA-Love deleted the feat/quick-open-line-jump branch April 22, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cmd + pで出てくる検索窓についての改善

1 participant