Skip to content

Draft: Delegate outline generation to Merlin #1529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tim-ats-d
Copy link

@Tim-ats-d Tim-ats-d commented May 19, 2025

Replacement of the in-house solution for generating outlines by Merlin.

I had to regenerate the tests because merlin and ocaml-lsp don't calculate the positions of elements in the outline in the same way. Fir instance, the y loc was the enclosing location for ocaml-lsp:

let x = object
  method y = 10
(*^^^^^^^^^^^^^*)  
end

While Merlin indicates the exact position:

let x = object
  method y = 10
      (* ^ *)  
end

The PR diff also indicates that several items kind value have changed from 7 to 13. Indeed, Merlin treats instance variables as Values and not as Property like ocaml-lsp does. This change simply means that the icon displayed on the vscode side will be different

Could you please mark this PR has draft? We have to wait for the next Merlin next because we need this patch ocaml/merlin#1936

@xvw xvw changed the title Delegate outline generation to Merlin Draft: Delegate outline generation to Merlin May 19, 2025
@Tim-ats-d Tim-ats-d changed the title Draft: Delegate outline generation to Merlin Draft:Delegate outline generation to Merlin May 19, 2025
@Tim-ats-d Tim-ats-d changed the title Draft:Delegate outline generation to Merlin Draft: Delegate outline generation to Merlin May 19, 2025
Copy link
Collaborator

@xvw xvw left a comment

Choose a reason for hiding this comment

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

What a nice PR! Thanks!

Comment on lines +389 to +390
"end": { "character": 10, "line": 2 },
"start": { "character": 9, "line": 2 }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sometime the result spans multiple lines like the previous one for a. But sometimes the only highlight the character like this one for b. Do you know why ?

I expect for most editors this is not an issue since they only use the start position ? But we might want to be a bit more careful about what we return here...

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