Unified symbol-to-docblock server command
[hiphop-php.git] / hphp / hack / src / server / hoverService.ml
blob3dba3f29964258acb81b37272558c7827007d413
1 (**
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 type hover_info = {
11 (** For fields and locals, this is the type. For method and function calls, it
12 is the signature, including any inferred types for generics.
13 This is also the only part of the hover info to get displayed as code
14 rather than Markdown. *)
15 snippet : string;
17 (** Additional information, such as doc string and declaration file. Displayed
18 as Markdown. *)
19 addendum : string list;
21 (** Position of this result. *)
22 pos : Pos.t option;
25 type result = hover_info list
27 let string_of_result { snippet; addendum; pos } =
28 Printf.sprintf "{ snippet = %S; addendum = [%s]; pos = %s }"
29 snippet
30 (String.concat "; " (List.map (fun s -> Printf.sprintf "%S" s) addendum))
31 (match pos with
32 | None -> "None"
33 | Some p -> Printf.sprintf "Some %S" (Pos.multiline_string_no_file p))