✨ Jump to Definition
@thecoolwinter がすでに取り組んでいます。
2025年7月26日 から。
評価
この issue はまだ評価されていません。
説明
Description
We would like to add a “Jump to Definition” feature that will allow users to quickly navigate to the definition or declaration of variables, functions, classes, and other symbols in their code. It will improve code navigation by letting users jump between symbol definitions efficiently.
Expected Behavior
- Jump to Definition should be triggered in the following ways:
- ⌘ clicking a symbol should execute the Jump to Definition action.
- ⌃ ⌘ J should jump to the symbol’s definition.
- The option should also be available from the Navigate menu under the name “Jump to Definition.”
- When the ⌘ key is held and the mouse hovers over a symbol, the symbol should display a background with the accent color to indicate it is clickable.
- Clicking the symbol or pressing the shortcut should:
- Check if the symbol has a valid definition within the same file or another file in the project.
- Navigate the user to the location of the symbol’s definition.
- If the symbol is defined in an external library or dependency, CodeEdit should provide a way to open the relevant file or show the external definition if possible.
Implementation Details
- Language Server Protocol (LSP) Integration:
- This feature can leverage LSP’s textDocument/definition capability for supported languages. The LSP server will return the location of the symbol’s definition, which CodeEdit will then navigate to.
- UI/UX Considerations:
- When ⌘ is held down and the mouse hovers over a symbol, the symbol should be highlighted with a background in the system’s accent color to indicate it’s clickable.
- If the symbol definition is within the same file, CodeEdit should smoothly scroll to the appropriate line.
- If the definition is in another file, CodeEdit should open that file and navigate to the correct line, focusing on the symbol’s definition.
- Menu Integration:
- Add a “Jump to Definition” option to the Navigate menu.
- Assign ⌃ ⌘ J as the default keyboard shortcut for this action.
- Error Handling:
- If the symbol definition cannot be found, an appropriate message (e.g., “Definition not found”) should be shown to the user.
- Handle cases where symbols may reference external dependencies gracefully, providing feedback if the symbol’s definition is unavailable.
Keyboard Shortcut & Menu Option:
- ⌃ ⌘ J should trigger the Jump to Definition command.
- The Navigate menu should include “Jump to Definition” as an option.
- ⌘ click on symbols should trigger the same action for mouse-based navigation.
Acceptance Criteria
- ⌘ clicking a symbol triggers the Jump to Definition action, and the symbol is highlighted with an accent color background while the command key is held.
- ⌃ ⌘ J successfully jumps to the definition of a selected symbol.
- The Jump to Definition option is available in the Navigate menu.
- If the definition is in the same file, smooth scrolling moves to the symbol’s definition.
- If the definition is in a different file, CodeEdit opens the file and navigates to the correct line.
- If the symbol definition cannot be found, an error message is displayed to the user.
- The feature works for languages supported by CodeEdit’s LSP integration.
- The accent color background appears when ⌘ is held, and the symbol is clickable.
Additional Context
- Future iterations could include a “Peek Definition” feature, allowing users to view definitions in a pop-up without leaving the current file.
- Support for external libraries or dependencies could be extended to provide more detailed navigation options.
Related Features:
- Integrate with a future Find All References feature for improved code exploration.
- Consider adding a “Peek Definition” feature.
Screenshots
https://github.com/user-attachments/assets/5c88e42e-d5d5-4ddc-9fde-0ef97db531bc
- 主要言語
- Swift
- スター
- 23k
- フォーク
- 1.2k
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CodeEditApp/CodeEdit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CodeEditApp/CodeEdit#2190 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 15/100
CodeEditApp/CodeEdit#2195 · リアクション 5 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
CodeEditApp/CodeEdit#2185 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
CodeEditApp/CodeEdit#2181 ·
-
creashes on starting オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
CodeEditApp/CodeEdit#2180 ·
CodeEditApp/CodeEdit の issue をすべて見る
似ている issue
-
area:dictation documentation P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
uttrflow/uttrflow-swift#1180 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
OneBusAway/onebusaway-ios#1451 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100