File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed
tests/test-dirs/type-enclosing Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ unreleased
1515 (#1609 , fixes #1529 and ocaml-lsp #1032 )
1616 - Fix ` construct ` results ordering for sum types sand poly variants (#1603 )
1717 - Fix object method completion not working (#1606 , fixes #1575 )
18+ - Improve context detection for package types (#1608 , fixes #1607 )
1819 + editor modes
1920 - emacs: call the user's configured completion UI in
2021 ` merlin-construct ` (#1598 )
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ let inspect_browse_tree ~cursor lid browse : t option =
148148 | Module_expr _
149149 | Open_description _ -> Some Module_path
150150 | Module_type _ -> Some Module_type
151+ | Core_type { ctyp_desc = Ttyp_package _ ; _ } -> Some Module_type
151152 | Core_type _ -> Some Type
152153 | Record_field (_ , lbl , _ ) when (Longident. last lid) = lbl.lbl_name ->
153154 (* if we stopped here, then we're on the label itself, and whether or
Original file line number Diff line number Diff line change 1+ $ cat > main. ml << EOF
2+ > module type Empty = sig end
3+ >
4+ > module Foo = struct
5+ > module type S = Empty
6+ >
7+ > let x = ()
8+ > end
9+ >
10+ > module type Foo = Foo. S
11+ >
12+ > let f (module M : Foo) = ()
13+ >
14+ > module S : sig
15+ > val f : (module Foo ) -> unit
16+ > end = struct
17+ > let f (module M : Foo) = ()
18+ > end
19+ > EOF
20+
21+ $ $ MERLIN single errors -filename main. ml < main. ml
22+ {
23+ " class" : " return" ,
24+ " value" : [],
25+ " notifications" : []
26+ }
27+
28+ That Foo is the module type Foo. S, not the module Foo
29+ $ $ MERLIN single type-enclosing -position 11 : 21 \
30+ > -filename main. ml < main. ml | jq ' .value[0]'
31+ {
32+ " start" : {
33+ " line" : 11 ,
34+ " col" : 18
35+ },
36+ " end" : {
37+ " line" : 11 ,
38+ " col" : 21
39+ },
40+ " type" : " Foo.S" ,
41+ " tail" : " no"
42+ }
43+
44+
45+ That Foo is the module type Foo. S, not the module Foo
46+ $ $ MERLIN single type-enclosing -position 14 : 19 \
47+ > -filename main. ml < main. ml | jq ' .value[0]'
48+ {
49+ " start" : {
50+ " line" : 14 ,
51+ " col" : 18
52+ },
53+ " end" : {
54+ " line" : 14 ,
55+ " col" : 21
56+ },
57+ " type" : " Foo.S" ,
58+ " tail" : " no"
59+ }
You can’t perform that action at this time.
0 commit comments