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

Draft: Reduce typedtree usage in infer interface #1367

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
allow-prerelease-opam: true

# Remove this pin once a compatible version of Merlin has been released
# - name: Pin dev Merlin
# run: opam pin https://github.com/ocaml/merlin.git#master
- name: Pin dev Merlin
run: opam pin https://github.com/ocaml/merlin.git#main

- name: Build and install dependencies
run: opam install .
Expand Down
21 changes: 4 additions & 17 deletions ocaml-lsp-server/src/inference.ml
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,10 @@ let infer_intf (state : State.t) intf_doc =
(** Extracts an [Ident.t] from all variants that have one at the top level. For
many of the other variants, it would be possible to extract a list of IDs,
but that's not needed for the update-signatures code action. *)
let top_level_id (item : Typedtree.signature_item) =
match item.sig_desc with
| Typedtree.Tsig_value { val_id; _ } -> Some val_id
| Typedtree.Tsig_module { md_id; _ } -> md_id
| Typedtree.Tsig_modsubst { ms_id; _ } -> Some ms_id
| Typedtree.Tsig_modtype { mtd_id; _ } -> Some mtd_id
| Typedtree.Tsig_modtypesubst { mtd_id; _ } -> Some mtd_id
| Typedtree.Tsig_type _
| Typedtree.Tsig_typesubst _
| Typedtree.Tsig_typext _
| Typedtree.Tsig_exception _
| Typedtree.Tsig_recmodule _
| Typedtree.Tsig_open _
| Typedtree.Tsig_include _
| Typedtree.Tsig_class _
| Typedtree.Tsig_class_type _
| Typedtree.Tsig_attribute _ -> None
let top_level_id item =
match Merlin_analysis.Typedtree_utils.extract_toplevel_identifier item with
| [ ident ] -> Some ident
| _ -> None
;;

(** Represents an item that's present in the existing interface and has a
Expand Down
Loading