Skip to content

Commit 06f4b29

Browse files
committed
Add tips
1 parent e3ad8fb commit 06f4b29

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

src/debugger/inspect/value_basic.ml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(**
2-
* Copyright (C) 2021 Yuxiang Wen
3-
*
2+
msg *
43
* This program is free software: you can redistribute it and/or modify
54
* it under the terms of the GNU Affero General Public License as
65
* published by the Free Software Foundation, either version 3 of the
@@ -50,15 +49,33 @@ let unknown_value =
5049
method to_short_string = "«opaque»"
5150
end
5251

52+
class raw_string_value v =
53+
object
54+
inherit value
55+
56+
method to_short_string = v
57+
end
58+
59+
class tips_value tips =
60+
object
61+
inherit value
62+
63+
method to_short_string = ""
64+
65+
method! num_indexed = Array.length tips
66+
67+
method! get_indexed i = new raw_string_value tips.(i) |> Lwt.return
68+
end
69+
5370
let adopters =
5471
ref
55-
( []
72+
([]
5673
: (Scene.t ->
5774
Typenv.t ->
5875
Scene.obj ->
5976
Types.type_expr ->
6077
value option Lwt.t)
61-
list )
78+
list)
6279

6380
let adopt scene typenv obj ty =
6481
let rec resolve_type ty =
@@ -75,8 +92,8 @@ let adopt scene typenv obj ty =
7592
} -> (
7693
match Typenv.type_apply typenv type_params body ty_args with
7794
| ty -> resolve_type ty
78-
| exception Ctype.Cannot_apply -> ty )
79-
| _ -> ty )
95+
| exception Ctype.Cannot_apply -> ty)
96+
| _ -> ty)
8097
| _ -> ty
8198
in
8299
let ty = resolve_type ty in

src/debugger/inspect/value_func.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ class func_value ?pc ?loc () =
2727
method! vscode_menu_context = Some "ocamlearlybird.function"
2828

2929
method! closure_code_location = loc
30+
31+
method! num_named = 1
32+
33+
method! list_named =
34+
Lwt.return
35+
[
36+
( "‹tips›",
37+
new tips_value
38+
[| "You can use context menu to goto closure code location." |] );
39+
]
3040
end
3141

3242
let adopter scene typenv obj typ =

0 commit comments

Comments
 (0)