Skip to content

Commit b50e0bf

Browse files
committed
Don't store ghost locations.
1 parent f5c97aa commit b50e0bf

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

analysis/src/Commands.ml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
let dumpLocations ~package ~file ~extra =
2-
let locations =
3-
extra.SharedTypes.locations
4-
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
5-
in
2+
let locations = extra.SharedTypes.locations in
63
locations
74
|> List.map (fun ((location : Location.t), loc) ->
85
let hoverText = Hover.newHover ~package ~file loc in
@@ -52,10 +49,7 @@ let complete ~path ~line ~col ~currentFile =
5249
print_endline result
5350

5451
let hover ~file ~line ~col ~extra ~package =
55-
let locations =
56-
extra.SharedTypes.locations
57-
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
58-
in
52+
let locations = extra.SharedTypes.locations in
5953
let pos = Utils.protocolLineColToCmtLoc ~line ~col in
6054
match References.locForPos ~extra:{extra with locations} pos with
6155
| None -> Protocol.null
@@ -94,10 +88,7 @@ let hover ~path ~line ~col =
9488
print_endline result
9589

9690
let definition ~file ~line ~col ~extra ~package =
97-
let locations =
98-
extra.SharedTypes.locations
99-
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
100-
in
91+
let locations = extra.SharedTypes.locations in
10192
let pos = Utils.protocolLineColToCmtLoc ~line ~col in
10293

10394
match References.locForPos ~extra:{extra with locations} pos with
@@ -135,10 +126,7 @@ let definition ~path ~line ~col =
135126
print_endline result
136127

137128
let references ~file ~line ~col ~extra ~package =
138-
let locations =
139-
extra.SharedTypes.locations
140-
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
141-
in
129+
let locations = extra.SharedTypes.locations in
142130
let pos = Utils.protocolLineColToCmtLoc ~line ~col in
143131

144132
match References.locForPos ~extra:{extra with locations} pos with
@@ -187,8 +175,7 @@ let documentSymbol ~path =
187175
| Module (Structure contents) -> (Module, getItems contents)
188176
| Module (Ident _) -> (Module, [])
189177
in
190-
if extentLoc.loc_ghost then siblings
191-
else (txt, extentLoc, item) :: siblings
178+
(txt, extentLoc, item) :: siblings
192179
in
193180
let x = topLevel |> List.map fn |> List.concat in
194181
x

analysis/src/ProcessCmt.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ let fileForCmt ~moduleName ~uri cmt =
524524
let extraForFile ~(file : SharedTypes.file) =
525525
let extra = initExtra () in
526526
let addLocation loc ident =
527-
extra.locations <- (loc, ident) :: extra.locations
527+
if not loc.Warnings.loc_ghost then
528+
extra.locations <- (loc, ident) :: extra.locations
528529
in
529530
let addReference stamp loc =
530531
Hashtbl.replace extra.internalReferences stamp

0 commit comments

Comments
 (0)