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

Presence of .merlin.skip-if-not-cwd skips config in dir #1870

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9be57bf
Prepare for release 4.15-414
voodoos May 31, 2024
89e00d2
[B] Merge pull request #1758 from xvw/tunneling-merlin-lsp-p1-split-p…
voodoos Jun 10, 2024
060404c
[B] Merge pull request #1778 from voodoos/find-command-opt
voodoos Jun 10, 2024
d129d7e
Prepare for release v4.16-414
voodoos Jun 10, 2024
5a98d88
Remove duplicate entry in changelog
voodoos Jun 10, 2024
16a1274
Merge pull request #1782 from voodoos/backports-414
voodoos Jun 10, 2024
a903759
Backport changes from issue #1798
bschommer Sep 11, 2024
10d3659
Backported Changes entry.
bschommer Sep 11, 2024
86c2a26
Merge pull request #1818 from bschommer/backport-1798
voodoos Sep 12, 2024
c3b78f8
[B] SOURCE_ROOT, UNIT_NAME and WRAPPING_PREFIX
voodoos Sep 25, 2024
570cd57
[B] #1795: Fix #1794: Add `-unboxed-types` and `-no-unboxed-types` to…
voodoos Sep 25, 2024
9d76cd6
[B] #1804 vim: remove references to MerlinPhrase
voodoos Sep 25, 2024
9ac5dea
[B] #1806 Ignore new Menhir deprecations
voodoos Sep 25, 2024
7eed27a
[B] #1800 Refinement in the presence of optional arguments
voodoos Sep 25, 2024
b8d97d5
[B] #1807 Check always that default args are option
voodoos Sep 25, 2024
f9901b1
[B] #1803 Fix ignorance of STDLIB in .merlin
voodoos Sep 25, 2024
cfa3683
[B] #1745 Expand PPX nodes
voodoos Sep 25, 2024
c4efe5c
[B] #1810 Produce a better error message when a flag spec appears mul…
voodoos Sep 25, 2024
a2105f4
[B] #1812 Inlay hint upstreaming
voodoos Sep 25, 2024
797e2a9
[B] #1814 Some UI improvement for `emacs/merlin-search`
voodoos Sep 25, 2024
55182d3
[B] #1811 Exposes some helper for reducing direct typedtree usage in Lsp
voodoos Sep 25, 2024
cdda0ec
[B] #1720 Signature Help
voodoos Sep 25, 2024
e438ad6
Compat with new occurrences api
voodoos Sep 25, 2024
5d5a94f
Setup codebase formatting and fix a few comments.
voodoos Sep 25, 2024
9f8a3c8
Format the codebase
voodoos Sep 25, 2024
f5f686e
Add commit to ignored revs
voodoos Sep 25, 2024
cb0da02
[B] #1828 Search by type feature, a kind of sherlodoc in Merlin
voodoos Sep 25, 2024
eaa241d
Promote fixed test after Dune upgrade
voodoos Sep 25, 2024
bbc283a
Silence ld warnings in tests
voodoos Sep 25, 2024
78d96ee
Enable github CI
voodoos Sep 25, 2024
59a67b4
[B] #1839 Fix ignorance of SOURCE_ROOT directive
voodoos Sep 25, 2024
16e46ba
Make deps explicit
patrick-nicodemus Sep 25, 2024
e7ed700
[B] #1841 Document missing commands in PROTOCOL.md
voodoos Sep 26, 2024
611e0ec
Prepare changelog for release 4.17-414
voodoos Sep 26, 2024
1d0b5a9
[B] Promote sherlodoc parser to sources
voodoos Sep 27, 2024
b17f7d1
Update changelog for release 4.17.1
voodoos Sep 27, 2024
44c1124
Update opam deps
voodoos Sep 27, 2024
3e61631
[B] #1854 Fix `EXCLUDE_QUERY_DIR` for cmt files
voodoos Nov 26, 2024
f6ea671
[B] #1856 Fix 1852 packaging issues
voodoos Nov 26, 2024
614add9
[B] #1858 from xvw/fix-1113 Fix #1113
voodoos Nov 26, 2024
758f839
[B] #1864 Fix type enclosing deduplication
voodoos Nov 26, 2024
162aa66
Prepare release 4.18-414
voodoos Nov 26, 2024
ee816ec
Remove strict dependency on dot-merlin-reader
voodoos Nov 26, 2024
2b9cd21
Merge pull request #1866 from voodoos/414-4.18-backports
voodoos Nov 26, 2024
e09ade6
Presence of .merlin.skip-if-not-cwd skips config in dir
jonahbeckford Dec 1, 2024
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
Prev Previous commit
Next Next commit
[B] #1811 Exposes some helper for reducing direct typedtree usage in Lsp
  • Loading branch information
voodoos committed Sep 26, 2024
commit 55182d37261b5d618f7860c555d370ccf518f6b7
20 changes: 10 additions & 10 deletions src/analysis/misc_utils.ml
Original file line number Diff line number Diff line change
@@ -58,13 +58,13 @@ let parenthesize_name name =
"(" ^ name ^ ")"
)

module Compat = struct
open Typedtree
let pat_var_id_and_loc = function
| { pat_desc = Tpat_var (id, loc); _ } -> Some (id, loc)
| _ -> None

let pat_alias_pat_id_and_loc = function
| { pat_desc = Tpat_alias (pat, id, loc); _ } -> Some (pat, id, loc)
| _ -> None
end
let parse_identifier (config, source) pos =
let path = Mreader.reconstruct_identifier config source pos in
let path = Mreader_lexer.identifier_suffix path in
Logger.log
~section:Type_enclosing.log_section
~title:"reconstruct-identifier"
"paths: [%s]"
(String.concat ~sep:";" (List.map path
~f:(fun l -> l.Location.txt)));
path
12 changes: 4 additions & 8 deletions src/analysis/misc_utils.mli
Original file line number Diff line number Diff line change
@@ -23,11 +23,7 @@ end
(* Add parenthesis to qualified operators *)
val parenthesize_name : string -> string

module Compat : sig
val pat_var_id_and_loc :
Typedtree.pattern -> (Ident.t * string Location.loc) option

val pat_alias_pat_id_and_loc
: Typedtree.pattern
-> (Typedtree.pattern * Ident.t * string Location.loc) option
end
(** [parse_identifier] attempts to re-parse a longident so that we get
the location of each of its components. *)
val parse_identifier :
(Mconfig.t * Msource.t) -> Lexing.position -> string Location.loc list
1 change: 1 addition & 0 deletions src/analysis/type_utils.ml
Original file line number Diff line number Diff line change
@@ -370,3 +370,4 @@ let is_deprecated =
("deprecated" | "ocaml.deprecated"); loc = _}, _ ->
true
| _ -> false)

51 changes: 51 additions & 0 deletions src/analysis/typedtree_utils.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
open Std

let extract_toplevel_identifier item =
match item.Typedtree.sig_desc with
| Typedtree.Tsig_value { val_id; _ } -> [val_id]
| Typedtree.Tsig_modsubst { ms_id; _ } -> [ms_id]
| Typedtree.Tsig_modtype { mtd_id; _ }
| Typedtree.Tsig_modtypesubst { mtd_id; _ } -> [mtd_id]
| Typedtree.Tsig_module { md_id; _ } -> Option.to_list md_id
| Typedtree.Tsig_recmodule mods ->
List.filter_map ~f:(fun Typedtree.{md_id; _} -> md_id) mods
| Typedtree.Tsig_class cls ->
List.map ~f:(fun Typedtree.{ ci_id_class; _} -> ci_id_class) cls
| Typedtree.Tsig_class_type cls ->
List.map
~f:(fun Typedtree.{ ci_id_class_type; _} -> ci_id_class_type)
cls
| Typedtree.Tsig_type _
| Typedtree.Tsig_typesubst _
| Typedtree.Tsig_typext _
| Typedtree.Tsig_exception _
| Typedtree.Tsig_open _
| Typedtree.Tsig_include _
| Typedtree.Tsig_attribute _ -> []

let let_bound_vars bindings =
List.filter_map ~f:(fun value_binding ->
match value_binding.Typedtree.vb_pat.pat_desc with
| Tpat_var (id, loc) -> Some (id, loc)
| Typedtree.Tpat_any
| Typedtree.Tpat_alias (_, _, _)
| Typedtree.Tpat_constant _
| Typedtree.Tpat_tuple _
| Typedtree.Tpat_construct (_, _, _, _)
| Typedtree.Tpat_variant (_, _, _)
| Typedtree.Tpat_record (_, _)
| Typedtree.Tpat_array _
| Typedtree.Tpat_lazy _
| Typedtree.Tpat_or (_, _, _) -> None
) bindings

let pat_var_id_and_loc = function
| Typedtree.{ pat_desc = Tpat_var (id, loc); _ } ->
Some (id, loc)
| _ -> None

let pat_alias_pat_id_and_loc = function
| Typedtree.{ pat_desc = Tpat_alias (pat, id, loc); _ } ->
Some (pat, id, loc)
| _ -> None

23 changes: 23 additions & 0 deletions src/analysis/typedtree_utils.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(** Utilities to keep explicit Typedtree manipulations local to Merlin_lib
for alternative clients like [ocaml-lsp]. *)

(** [extract_toplevel_identifier sigitem] extracts toplevel identifier of
a signature item. It returns a list for dealing with recursive elements. *)
val extract_toplevel_identifier : Typedtree.signature_item -> Ident.t list

(** [let_bound_vars binding_list] extract the [Ident.t] and the
location of variables bind in the form of [let b = e ...] in a
list of bindings. *)
val let_bound_vars :
Typedtree.value_binding list -> (Ident.t * string Location.loc) list

(** [pat_var_id_and_loc] try to extract the [id] and the [location] of
pattern variable. *)
val pat_var_id_and_loc :
Typedtree.pattern -> (Ident.t * string Location.loc) option

(** [pat_alias_id_and_loc] try to extract the [id] and the [location]
of pattern alias. *)
val pat_alias_pat_id_and_loc
: Typedtree.pattern
-> (Typedtree.pattern * Ident.t * string Location.loc) option