Skip to content

Commit

Permalink
Mbrowse.select_leaf: correctly ignore merlin.hide
Browse files Browse the repository at this point in the history
  • Loading branch information
trefis committed Aug 6, 2021
1 parent 9961a1d commit 6047d1f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/kernel/mbrowse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ let select_leafs pos root =
let branches = ref [] in
let rec select_child branch env node has_selected =
let loc = node_merlin_loc node in
if Location_aux.compare_pos pos loc = 0 then
let attrs = Browse_raw.node_attributes node in
if Location_aux.compare_pos pos loc = 0 &&
not (has_attr "merlin.hide" attrs)
then
(traverse ((env, node) :: branch); true)
else
has_selected
Expand Down
29 changes: 27 additions & 2 deletions tests/test-dirs/type-enclosing/merlin-hide.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,32 @@ accessible:
> end
> EOF
{
"class": "failure",
"value": "hd",
"class": "return",
"value": [
{
"start": {
"line": 1,
"col": 11
},
"end": {
"line": 5,
"col": 3
},
"type": "sig val x : int end",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 0
},
"end": {
"line": 5,
"col": 3
},
"type": "sig val x : int end",
"tail": "no"
}
],
"notifications": []
}

0 comments on commit 6047d1f

Please sign in to comment.