Skip to content

Fix tree-sitter go to definition from context menus#3350

Merged
sdottaka merged 2 commits into
WinMerge:feature/tree-sitterfrom
Thorium:fix-tree-sitter-goto-definition-context-menu
Apr 30, 2026
Merged

Fix tree-sitter go to definition from context menus#3350
sdottaka merged 2 commits into
WinMerge:feature/tree-sitterfrom
Thorium:fix-tree-sitter-goto-definition-context-menu

Conversation

@Thorium

@Thorium Thorium commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move the caret to the symbol under the mouse before running context-menu navigation commands
  • prefer the tagged definition target when a right-clicked type reference resolves to the current line instead of the earlier type definition
  • fix right-click go-to-definition for type annotations

Update right-click navigation to resolve the symbol under the mouse and prefer tagged type definitions when the position-based lookup stays on the current line.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves “Go to definition” behavior when invoked from editor context menus by aligning the caret with the right-clicked symbol and refining tree-sitter definition target selection to avoid resolving back to the clicked reference.

Changes:

  • Update merge editor context-menu handling to move the caret to the mouse location before showing the menu.
  • Adjust tree-sitter definition resolution to prefer tag-based targets in specific “self-resolving” cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Src/MergeEditView.cpp Moves caret/selection to the right-clicked text position prior to displaying the context menu.
Externals/crystaledit/editlib/TreeSitterParser.cpp Refines FindDefinition logic to optionally prefer tag-definition targets over position-based targets in certain cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Src/MergeEditView.cpp Outdated
Comment thread Externals/crystaledit/editlib/TreeSitterParser.cpp Outdated
Comment thread Externals/crystaledit/editlib/TreeSitterParser.cpp Outdated
Comment thread Src/MergeEditView.cpp Outdated
@sdottaka

Copy link
Copy Markdown
Member

@Thorium

Could you please take a look at the Copilot review and fix any issues if needed?

@sdottaka sdottaka merged commit 7c99c6a into WinMerge:feature/tree-sitter Apr 30, 2026
2 checks passed
@sdottaka

Copy link
Copy Markdown
Member

Thank you!

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.

3 participants