✨ Jump to Definition
@thecoolwinter y travaille déjà.
Depuis le 26/7/2025.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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
- Langage dominant
- Swift
- Étoiles
- 23k
- Forks
- 1.2k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de CodeEditApp/CodeEdit
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
CodeEditApp/CodeEdit#2190 ·
-
Is this project dead? Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 15/100
CodeEditApp/CodeEdit#2195 · 7 réactions ·
-
enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
CodeEditApp/CodeEdit#2185 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
CodeEditApp/CodeEdit#2181 ·
-
creashes on starting Ouvertebug
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
CodeEditApp/CodeEdit#2180 ·
Toutes les issues de CodeEditApp/CodeEdit
Issues similaires
-
task
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
vsanthanam/JBird#429 ·
-
Bolus validation button text Ouverteneeds-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
nightscout/Trio#1574 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
pending-maintainer-response pending-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
make notarise-dmg notarises whichever dist/ image sorts last, not the one make dmg just built Ouvertearea:build bug good first issue P2
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
uttrflow/uttrflow-swift#1412 ·