Skip to content

Commit 5835ab7

Browse files
committed
fix completing uncompiled across files
1 parent 1242d57 commit 5835ab7

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,9 @@ let completionForExporteds iterExported getDeclared ~prefix ~exact ~env
562562
with
563563
deprecated = declared.deprecated;
564564
docstring = declared.docstring;
565-
modulePath = ModulePath.toPathWithoutTip declared.modulePath;
565+
modulePath =
566+
[env.file.moduleName]
567+
@ ModulePath.toPathWithoutTip declared.modulePath;
566568
}
567569
:: !res
568570
| _ -> ());

analysis/tests/src/CompletionPipeChain.res

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,9 @@ let f = int->Integer.increment(2)
4848

4949
// let _ = int->Integer.increment(2)->SuperFloat.fromInteger->t
5050
// ^com
51+
52+
// let _ = int->Integer.increment(2)->Integer.toInt->CompletionSupport.Test.make->
53+
// ^com
54+
55+
// let _ = CompletionSupport.Test.make(1)->CompletionSupport.Test.addSelf(2)->
56+
// ^com
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Test = {
2+
type t = {name: int}
3+
let add = (ax: t) => ax.name + 1
4+
let addSelf = (ax: t) => {name: ax.name + 1}
5+
let make = (name: int): t => {name: name}
6+
}

analysis/tests/src/expected/CompletionPipeChain.res.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,49 @@ Completable: Cpath Value[SuperFloat, fromInteger](Nolabel)->t
188188
"documentation": null
189189
}]
190190

191+
Complete src/CompletionPipeChain.res 51:82
192+
posCursor:[51:82] posNoWhite:[51:81] Found expr:[51:11->0:-1]
193+
Completable: Cpath Value[CompletionSupport, Test, make](Nolabel)->
194+
[{
195+
"label": "add",
196+
"kind": 12,
197+
"tags": [],
198+
"detail": "t => int",
199+
"documentation": null
200+
}, {
201+
"label": "addSelf",
202+
"kind": 12,
203+
"tags": [],
204+
"detail": "t => t",
205+
"documentation": null
206+
}, {
207+
"label": "make",
208+
"kind": 12,
209+
"tags": [],
210+
"detail": "int => t",
211+
"documentation": null
212+
}]
213+
214+
Complete src/CompletionPipeChain.res 54:78
215+
posCursor:[54:78] posNoWhite:[54:77] Found expr:[54:11->0:-1]
216+
Completable: Cpath Value[CompletionSupport, Test, addSelf](Nolabel, Nolabel)->
217+
[{
218+
"label": "add",
219+
"kind": 12,
220+
"tags": [],
221+
"detail": "t => int",
222+
"documentation": null
223+
}, {
224+
"label": "addSelf",
225+
"kind": 12,
226+
"tags": [],
227+
"detail": "t => t",
228+
"documentation": null
229+
}, {
230+
"label": "make",
231+
"kind": 12,
232+
"tags": [],
233+
"detail": "int => t",
234+
"documentation": null
235+
}]
236+

analysis/tests/src/expected/CompletionSupport.res.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)