File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -946,6 +946,32 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
946
946
setResult
947
947
(Completable. CdecoratorPayload
948
948
(JsxConfig {nested = List. rev nested; prefix})))
949
+ | _ -> ()
950
+ else if id.txt = " mainTypeForModule" then
951
+ match payload with
952
+ | PStr
953
+ [
954
+ {
955
+ pstr_desc =
956
+ Pstr_eval
957
+ ( {
958
+ pexp_loc;
959
+ pexp_desc = Pexp_construct ({txt = path; loc}, None );
960
+ },
961
+ _ );
962
+ };
963
+ ]
964
+ when locHasCursor pexp_loc ->
965
+ if Debug. verbose () then
966
+ print_endline " [decoratorCompletion] Found @mainTypeForModule" ;
967
+ setResult
968
+ (Completable. Cpath
969
+ (CPId
970
+ {
971
+ path = Utils. flattenLongIdent path;
972
+ completionContext = Module ;
973
+ loc;
974
+ }))
949
975
| _ -> () );
950
976
Ast_iterator. default_iterator.attribute iterator (id, payload)
951
977
in
Original file line number Diff line number Diff line change @@ -34,3 +34,6 @@ let nn: SomeOtherModule.t = {nname: "hello"}
34
34
// nn.
35
35
// ^com
36
36
// ^dv-
37
+
38
+ // @mainTypeForModule(SomeOthe) type typeOutsideModule = {nname: string}
39
+ // ^com
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ Path SomeModule.
35
35
36
36
Complete src/CompletionFromModule.res 33:6
37
37
posCursor:[33:6] posNoWhite:[33:5] Found expr:[33:3->33:6]
38
- Pexp_field [33:3->33:5] _:[37 :0->33:6]
38
+ Pexp_field [33:3->33:5] _:[40 :0->33:6]
39
39
[set_result] set new result to Cpath Value[nn].""
40
40
Completable: Cpath Value[nn].""
41
41
Package opens Pervasives.JsxModules.place holder
@@ -77,3 +77,18 @@ Path SomeOtherModule.
77
77
}]
78
78
79
79
80
+ Complete src/CompletionFromModule.res 37:30
81
+ XXX Not found!
82
+ Completable: Cpath Module[SomeOthe]
83
+ Package opens Pervasives.JsxModules.place holder
84
+ Resolved opens 1 pervasives
85
+ ContextPath Module[SomeOthe]
86
+ Path SomeOthe
87
+ [{
88
+ "label": "SomeOtherModule",
89
+ "kind": 9,
90
+ "tags": [],
91
+ "detail": "module SomeOtherModule",
92
+ "documentation": null
93
+ }]
94
+
You can’t perform that action at this time.
0 commit comments