Skip to content

Commit e0528c0

Browse files
authored
Show Stdlib.Null and Stdlib.Nullable completions for Stdlib.null<'a> and Stdlib.nullable<'a> types, respectively (#7826)
* Add failing test for Stdlib.null<'a> and Stdlib.nullable<'a> completion * Treat Primitive_js_extern.null and Primitive_js_extern.nullable as Stdlib_Null and Stdlib_Nullable for completion * Add CHANGELOG
1 parent 22f68af commit e0528c0

File tree

4 files changed

+404
-0
lines changed

4 files changed

+404
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#### :bug: Bug fix
2222

23+
- Show `Stdlib.Null` and `Stdlib.Nullable` completions for `Stdlib.null<'a>` and `Stdlib.nullable<'a>` types, respectively. https://github.com/rescript-lang/rescript/pull/7826
2324
- Fix generation of interfaces for module types containing multiple type constraints. https://github.com/rescript-lang/rescript/pull/7825
2425

2526
#### :memo: Documentation

analysis/src/TypeUtils.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,4 +1291,6 @@ let completionPathFromMaybeBuiltin path =
12911291
| [mainModule; "t"] when String.starts_with ~prefix:"Stdlib_" mainModule ->
12921292
(* Route Stdlib_X to Stdlib.X for proper completions without the Stdlib_ prefix *)
12931293
Some (String.split_on_char '_' mainModule)
1294+
| ["Primitive_js_extern"; "null"] -> Some ["Stdlib"; "Null"]
1295+
| ["Primitive_js_extern"; "nullable"] -> Some ["Stdlib"; "Nullable"]
12941296
| _ -> None)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let x: null<unit> = Stdlib_Null.null
2+
3+
// x.
4+
// ^com
5+
6+
let y: nullable<unit> = null
7+
8+
// y.
9+
// ^com

0 commit comments

Comments
 (0)