✨ Jump to Definition
@thecoolwinter arbeitet bereits daran.
Seit 26.7.2025.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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
- Vorherrschende Sprache
- Swift
- Sterne
- 23k
- Forks
- 1.2k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CodeEditApp/CodeEdit
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CodeEditApp/CodeEdit#2190 ·
-
Is this project dead? Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 15/100
CodeEditApp/CodeEdit#2195 · 7 Reaktionen ·
-
enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
CodeEditApp/CodeEdit#2185 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
CodeEditApp/CodeEdit#2181 ·
-
creashes on starting Offenbug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
CodeEditApp/CodeEdit#2180 ·
Alle Issues in CodeEditApp/CodeEdit
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-swift#1151 ·
-
`--app` focus through the daemon can pick an off-screen window and refuse with `axElementNotFound` Offenclawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster no-stale P1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
code health
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
apple/coreai-models#288 ·
-
task
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
vsanthanam/JBird#429 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100