Skip to content

Commit a75787a

Browse files
committed
ignore semantic tokens at ghost locations
1 parent 254559b commit a75787a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ocaml-lsp-server/src/semantic_highlighting.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ end = struct
188188
let append_token : t -> Loc.t -> Token_type.t -> Token_modifiers_set.t -> unit
189189
=
190190
fun t loc token_type token_modifiers ->
191+
if loc.loc_ghost then () else
191192
let range = Range.of_loc_opt loc in
192193
Option.iter range ~f:(fun ({ start; end_ } : Range.t) ->
193194
(* TODO: we currently don't handle multi-line range; could handle if
@@ -294,6 +295,7 @@ end = struct
294295
https://v2.ocaml.org/manual/names.html#sss:refer-named *)
295296
let lident ({ loc; _ } : Longident.t Loc.loc) rightmost_name
296297
?(modifiers = Token_modifiers_set.empty) () =
298+
if loc.loc_ghost then () else
297299
let start = Position.of_lexical_position loc.loc_start in
298300
match start with
299301
| None -> ()

0 commit comments

Comments
 (0)