Skip to content

Commit

Permalink
Add tips
Browse files Browse the repository at this point in the history
  • Loading branch information
hackwaly committed Feb 22, 2021
1 parent e3ad8fb commit 06f4b29
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/debugger/inspect/value_basic.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(**
* Copyright (C) 2021 Yuxiang Wen
*
msg *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
Expand Down Expand Up @@ -50,15 +49,33 @@ let unknown_value =
method to_short_string = "«opaque»"
end

class raw_string_value v =
object
inherit value

method to_short_string = v
end

class tips_value tips =
object
inherit value

method to_short_string = ""

method! num_indexed = Array.length tips

method! get_indexed i = new raw_string_value tips.(i) |> Lwt.return
end

let adopters =
ref
( []
([]
: (Scene.t ->
Typenv.t ->
Scene.obj ->
Types.type_expr ->
value option Lwt.t)
list )
list)

let adopt scene typenv obj ty =
let rec resolve_type ty =
Expand All @@ -75,8 +92,8 @@ let adopt scene typenv obj ty =
} -> (
match Typenv.type_apply typenv type_params body ty_args with
| ty -> resolve_type ty
| exception Ctype.Cannot_apply -> ty )
| _ -> ty )
| exception Ctype.Cannot_apply -> ty)
| _ -> ty)
| _ -> ty
in
let ty = resolve_type ty in
Expand Down
10 changes: 10 additions & 0 deletions src/debugger/inspect/value_func.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class func_value ?pc ?loc () =
method! vscode_menu_context = Some "ocamlearlybird.function"

method! closure_code_location = loc

method! num_named = 1

method! list_named =
Lwt.return
[
( "‹tips›",
new tips_value
[| "You can use context menu to goto closure code location." |] );
]
end

let adopter scene typenv obj typ =
Expand Down

0 comments on commit 06f4b29

Please sign in to comment.