Skip to content

Commit

Permalink
Add code action for inlining (#847)
Browse files Browse the repository at this point in the history
* start work on inline action

* basic inlining works

* fix special case with labeled args

* cleanup

* promote tests

* extract the relevant part of parsetree instead of using untypedast

* fix bug with shadowing

* refactor

* address comments

* handle optional arguments correctly

* fix find_parsetree_loc

* use parsetree from before ppx expansion

* strip merlin.loc attributes

* check for shadowing before inlining

* refactor

* remove test code

* formatting

* fix incorrect comment

* perform beta reduction after inlining function

* continue work on beta reduction

* early exit from search for inline source

* basic beta reduction now works on pre-ppx parsetree

* handle labeled arguments in beta reduce

* fix inlining functions with constrained args

* add tests for inlining action

* start work on top level let support

* fix bugs related to optional arguments

* beta reduce literal tuple arguments

* add more tests

* remove test module

* update changes

* formatting

* add mli

* use raise_notrace

* refactor to use Option.O in whole function

* explain error value

* extract reusable functions

* explain todos

* cleanup
  • Loading branch information
jfeser committed Oct 10, 2022
1 parent 9a02a04 commit 8730a82
Show file tree
Hide file tree
Showing 10 changed files with 1,083 additions and 50 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Features

- Code action for inlining let bindings within a module or expression. (#847)

- Tag "unused code" and "deprecated" warnings, allowing clients to better
display them. (#848)

Expand Down
1 change: 1 addition & 0 deletions ocaml-lsp-server/src/code_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ let compute server (params : CodeActionParams.t) =
; Action_add_rec.t
; Action_mark_remove_unused.mark
; Action_mark_remove_unused.remove
; Action_inline.t
]
in
List.concat
Expand Down
Loading

0 comments on commit 8730a82

Please sign in to comment.