Skip to content
Snippets Groups Projects

[#2094] Add documentation to LSP hovers

Merged Sorokin-Anton requested to merge Sorokin-Anton/#2094-comments-in-ast into dev
2 files
+ 11
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -52,7 +52,7 @@ let rec hook mk_attr attrs node =
let hook_E_Attr = hook @@ fun a e -> E_Attr (a,e)
let hook_T_Attr = hook @@ fun a t -> T_Attr (a,t)
(* Transforming comments related to declarations to attributes *)
(* Transforming comments related to declarations to attributes *)
let add_comments_as_attributes decl comments =
let add_one_comment decl comment =
match comment with
@@ -71,6 +71,7 @@ let add_comments_as_sig_attributes sig_item comments =
| Line _ -> sig_item
in Core.List.fold ~init:sig_item ~f:add_one_comment comments
(* END HEADER *)
%}
@@ -292,11 +293,11 @@ type_decl:
"type" ioption(type_vars) type_name "=" type_expr {
let region = cover $1#region (type_expr_to_region $5)
and value = {kwd_type=$1; params=$2; name=$3; eq=$4; type_expr=$5}
in {region; value}, $1#comments }
in {body = {region; value}; comments = $1#comments} }
global_type_decl:
type_decl {
let decl, comments = $1 in
let {body = decl; comments} = $1 in
let decl = D_Type decl in
add_comments_as_attributes decl comments }
@@ -565,11 +566,11 @@ module_decl:
"module" module_name ioption(module_constraint) "=" module_expr {
let region = cover $1#region (module_expr_to_region $5)
and value = {kwd_module=$1; name=$2; eq=$4; module_expr=$5; annotation=$3}
in {region; value}, $1#comments }
in {body = {region; value}; comments = $1#comments} }
global_module_decl:
module_decl {
let decl, comments = $1 in
let {body = decl; comments} = $1 in
let decl = D_Module decl in
add_comments_as_attributes decl comments }
@@ -936,7 +937,7 @@ let_mut_in_expr(right_expr):
local_type_decl(right_expr):
type_decl "in" right_expr {
let decl, _comments = $1 in
let {body = decl; comments = _} = $1 in
let region = cover decl.region (expr_to_region $3)
and value = {type_decl=decl; kwd_in=$2; body=$3}
in E_TypeIn {region; value} }
@@ -945,7 +946,7 @@ local_type_decl(right_expr):
local_module_decl(right_expr):
module_decl "in" right_expr {
let decl, _comments = $1 in
let {body = decl; comments = _} = $1 in
let region = cover decl.region (expr_to_region $3)
and value = {mod_decl=decl; kwd_in=$2; body=$3}
in E_ModIn {region; value} }
Loading