Skip to content

Fix locate when cursor is on another declaration - #2118

Open
aryemans wants to merge 3 commits into
ocaml:mainfrom
aryemans:fix/issue-2033
Open

Fix locate when cursor is on another declaration#2118
aryemans wants to merge 3 commits into
ocaml:mainfrom
aryemans:fix/issue-2033

Conversation

@aryemans

Copy link
Copy Markdown

Fixes #2033.

When locate is invoked with an explicit identifier while the cursor is on a different declaration, context detection currently treats the cursor position as the definition point and returns Already at definition point.

This changes declaration context detection so that it only reports being at the origin when the declaration under the cursor has the same name as the requested identifier. Otherwise, lookup continues normally.

The fix covers value and type declarations and adds a regression test for the reported case.

Tests:

  • dune runtest tests/test-dirs/locate/issue2033.t
  • dune build @all-locate-tests
  • dune runtest

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.

Unable to find declaration of type when editor position is in another declaration

1 participant