Skip to content
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

[New Command] Expand PPX nodes #1745

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

Conversation

PizieDust
Copy link
Contributor

@PizieDust PizieDust commented Apr 2, 2024

closes #1744
This implementation has support for:

  • Ppx derivers written using ppxlib
  • Ppx derivers written using ppx_deriving
  • Ppx rewriters

src/frontend/query_commands.ml Outdated Show resolved Hide resolved
src/frontend/query_protocol.ml Outdated Show resolved Hide resolved
src/kernel/mbrowse.ml Outdated Show resolved Hide resolved
src/kernel/mbrowse.ml Outdated Show resolved Hide resolved
src/kernel/mbrowse.ml Outdated Show resolved Hide resolved
src/kernel/mbrowse.ml Outdated Show resolved Hide resolved
Copy link
Member

@pitag-ha pitag-ha left a comment

Choose a reason for hiding this comment

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

This looks very nice and is a very useful feature. Thanks a lot, @PizieDust! two general comments:

As a suggestion for an addition to the tests: It would be interesting to test what happens when you use the feature on a deriver that's not registered via dune. Or when you use it on a deriver that triggers some other error, e.g. you call it with a flag, when it doesn't support flags, or it expects some value to be in scope that's not in scope. In those cases, do the errors appear as "derived code" or not?

And as a nit-pick: merlin-lib doesn't know about hover, so the title of the PR is a little misleading. The part of your work about hover is the related work you've done on ocaml-lsp.

src/frontend/query_commands.ml Outdated Show resolved Hide resolved
src/frontend/query_commands.ml Outdated Show resolved Hide resolved
src/kernel/mbrowse.ml Outdated Show resolved Hide resolved
@PizieDust PizieDust changed the title Expand PPX on hover [New Command] Expand PPX nodes Apr 16, 2024
@PizieDust PizieDust marked this pull request as draft May 10, 2024 22:23
@PizieDust PizieDust marked this pull request as ready for review May 27, 2024 05:50
@PizieDust PizieDust requested review from xvw and pitag-ha May 27, 2024 05:51
Copy link
Collaborator

@voodoos voodoos left a comment

Choose a reason for hiding this comment

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

I dit a round of review. I did not tackle the heart of the PR yet

src/analysis/completion.ml Outdated Show resolved Hide resolved
src/commands/query_json.ml Outdated Show resolved Hide resolved
src/frontend/query_protocol.ml Outdated Show resolved Hide resolved
src/ocaml/merlin_specific/browse_raw.ml Outdated Show resolved Hide resolved
tests/test-dirs/expand_node/ppx-tests.t/rewriter/dune Outdated Show resolved Hide resolved
tests/test-dirs/expand_node/ppx-tests.t/run.t Show resolved Hide resolved
src/frontend/query_commands.ml Outdated Show resolved Hide resolved
src/frontend/query_commands.ml Outdated Show resolved Hide resolved
src/frontend/query_commands.ml Outdated Show resolved Hide resolved
src/frontend/query_commands.ml Outdated Show resolved Hide resolved
Add parsetree processing functions

Mbrowse for parsetrees

Browse_raw for parsetrees

expand node logic

add tests

refactor logic

better json response

use lexing locations

refactor type exceptions

discard tests of external dependencies

custom ppx deriver that just renames

tests for expand-node feature

ensure location invariants by setting loc_ghost to true

cover all ghost locations

updated changelog

add eof to tests

properly handle type_exceptions in browse_raw

add helper functions

remove private function from public scope

change logic to use typedtree

add helper functions for str items and sig items

more tests

remote unused variant

better naming

better linting

lint

unrelated test change due to type_exception fixup in the Typedtree

Remove Mbrowse and Browse raw modules for the Pasetree

better alignment

better tests

output with attribute loc range

refactoring of ppx-expand logic

refactor pretty print nodes

return list of ppx nodes and not just head

add ppx rewriter

refactor logic to use Ast_iterator

remove unused code

update test

remove unused code

remove redundant code

remove whitespace
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.

Implement Enhanced Hover Feature for PPXs in Merlin
4 participants