File tree 3 files changed +20
-5
lines changed
3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 12
12
13
13
## master
14
14
15
+ #### :bug : Bug Fix
16
+
17
+ - More robust handling of namespaces in pipe completions. https://github.com/rescript-lang/rescript-vscode/pull/850
18
+
15
19
## 1.24.0
16
20
17
21
#### :bug : Bug Fix
Original file line number Diff line number Diff line change @@ -943,10 +943,6 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
943
943
| [_], _ -> Some modulePath
944
944
| s :: inner , first :: restPath when s = first ->
945
945
removeRawOpen inner restPath
946
- | s :: inner, first :: restPath
947
- when String. contains first '-' && Utils. startsWith first s ->
948
- (* This handles namespaced modules, which have their namespace appended after a '-' *)
949
- removeRawOpen inner restPath
950
946
| _ -> None
951
947
in
952
948
let rec removeRawOpens rawOpens modulePath =
@@ -959,7 +955,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
959
955
| [] -> modulePath
960
956
in
961
957
let completionPathMinusOpens =
962
- completionPath
958
+ completionPath |> Utils. flattenAnyNamespaceInPath
963
959
|> removeRawOpens package.opens
964
960
|> removeRawOpens rawOpens |> String. concat " ."
965
961
in
Original file line number Diff line number Diff line change @@ -228,3 +228,18 @@ let fileNameHasUnallowedChars s =
228
228
ignore (Str. search_forward regexp s 0 );
229
229
true
230
230
with Not_found -> false
231
+
232
+ (* Flattens any namespace in the provided path.
233
+ Example:
234
+ Globals-RescriptBun.URL.t (which is an illegal path because of the namespace) becomes:
235
+ RescriptBun.Globals.URL.t
236
+ *)
237
+ let rec flattenAnyNamespaceInPath path =
238
+ match path with
239
+ | [] -> []
240
+ | head :: tail ->
241
+ if String. contains head '-' then
242
+ let parts = String. split_on_char '-' head in
243
+ (* Namespaces are in reverse order, so "URL-RescriptBun" where RescriptBun is the namespace. *)
244
+ (parts |> List. rev) @ flattenAnyNamespaceInPath tail
245
+ else head :: flattenAnyNamespaceInPath tail
You can’t perform that action at this time.
0 commit comments