✨ Jump to Definition
@thecoolwinter ci sta già lavorando.
Dal 26/7/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- Swift
- Stelle
- 23k
- Fork
- 1.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeEditApp/CodeEdit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CodeEditApp/CodeEdit#2190 ·
-
Is this project dead? Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 15/100
CodeEditApp/CodeEdit#2195 · 5 reazioni ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CodeEditApp/CodeEdit#2185 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
CodeEditApp/CodeEdit#2181 ·
-
creashes on starting Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CodeEditApp/CodeEdit#2180 ·
Tutte le issue di CodeEditApp/CodeEdit
Issue simili
-
The correction-threshold rationale says 17 restraint cases collide; the current corpus has 16 Apertaarea:dictation documentation P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
uttrflow/uttrflow-swift#1180 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
OneBusAway/onebusaway-ios#1451 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
type: docs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
googleapis/google-cloud-swift#971 ·