diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 61b15b91e..d32d6b253 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -49,7 +49,7 @@ jobs: # Remove this pin once a compatible version of Merlin has been released - name: Pin dev Merlin - run: opam --cli=2.1 pin --with-version=5.4-503 https://github.com/ocaml/merlin.git#main + run: opam --cli=2.1 pin --with-version=5.4-503 https://github.com/liam923/merlin.git#rename-holes - name: Build and install dependencies run: opam install . diff --git a/ocaml-lsp-server/src/code_actions/action_construct.ml b/ocaml-lsp-server/src/code_actions/action_construct.ml index 3fd5ea045..5a529543f 100644 --- a/ocaml-lsp-server/src/code_actions/action_construct.ml +++ b/ocaml-lsp-server/src/code_actions/action_construct.ml @@ -14,7 +14,7 @@ let code_action pipeline doc (params : CodeActionParams.t) = let src = Document.source doc in Compl.prefix_of_position ~short_path:false src pos in - if not (Typed_hole.can_be_hole prefix) + if not (Merlin_analysis.Typed_hole.can_be_hole prefix) then None else ( let structures = @@ -25,7 +25,7 @@ let code_action pipeline doc (params : CodeActionParams.t) = let pos = Mpipeline.get_lexing_pos pipeline pos in Mbrowse.enclosing pos [ Mbrowse.of_typedtree typedtree ] in - if not (Typed_hole.is_a_hole structures) + if not (Merlin_analysis.Typed_hole.is_a_hole structures) then None else ( (* ocaml-lsp can provide [Construct] values as completion entries, so diff --git a/ocaml-lsp-server/src/compl.ml b/ocaml-lsp-server/src/compl.ml index 3ef48110e..c5054ff2f 100644 --- a/ocaml-lsp-server/src/compl.ml +++ b/ocaml-lsp-server/src/compl.ml @@ -315,7 +315,7 @@ let complete let* item = completion_item_capability in item.deprecatedSupport) in - if not (Typed_hole.can_be_hole prefix) + if not (Merlin_analysis.Typed_hole.can_be_hole prefix) then Complete_by_prefix.complete merlin prefix pos ~resolve ~deprecated else ( let reindex_sortText completion_items = diff --git a/ocaml-lsp-server/src/typed_hole.ml b/ocaml-lsp-server/src/typed_hole.ml deleted file mode 100644 index 0dcd83a58..000000000 --- a/ocaml-lsp-server/src/typed_hole.ml +++ /dev/null @@ -1,19 +0,0 @@ -open Import - -let syntax_repr = "_" -let can_be_hole s = String.equal syntax_repr s - -(* the pattern matching below is taken and modified (minimally, to adapt the - return type) from [Query_commands.dispatch]'s [Construct] branch; - - If we directly dispatched [Construct] command to merlin, we'd be doing - useless computations: we need info whether the expression at the cursor is a - hole, we don't need constructed expressions yet. - - Ideally, merlin should return a callback [option], which is [Some] when the - context is applicable. *) -let is_a_hole = function - | (_, Browse_raw.Module_expr { mod_desc = Tmod_hole; _ }) :: (_, _) :: _ - | (_, Browse_raw.Expression { exp_desc = Texp_hole; _ }) :: _ -> true - | [] | (_, _) :: _ -> false -;; diff --git a/ocaml-lsp-server/src/typed_hole.mli b/ocaml-lsp-server/src/typed_hole.mli deleted file mode 100644 index 083f5e8f0..000000000 --- a/ocaml-lsp-server/src/typed_hole.mli +++ /dev/null @@ -1,17 +0,0 @@ -open Import - -(** This module should be used to work with typed holes. The main goal is to - hide syntactic representation of a typed hole, which may change in future *) - -(** checks whether the current string matches the syntax representation of a - typed hole *) -val can_be_hole : string -> bool - -(** [is_a_hole nodes] checks whether the leaf node [1] is a typed hole - - Note: this function is extracted from merlin sources handling [Construct] - command in [merlin/src/frontend/query_commands.ml] - - [1] leaf node is the head of the list, as - [Mbrowse.t = (Env.t * Browse_raw.node) list]*) -val is_a_hole : Mbrowse.t -> bool