Skip to content

Commit 22f7725

Browse files
aspeddrozth
authored andcommitted
move function to Utils module
1 parent 4627227 commit 22f7725

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

analysis/src/SemanticTokens.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,7 @@ let command ~debug ~emitter ~path =
311311
cases
312312
|> List.filter_map (fun ((label : Longident.t Location.loc), _) ->
313313
match label.txt with
314-
| Longident.Lident s
315-
when String.length s > 0
316-
&& not (Char.equal s.[0] (Char.uppercase_ascii s.[0])) ->
314+
| Longident.Lident s when Utils.isFirstCharUppercase s ->
317315
Some label
318316
| _ -> None)
319317
|> List.iter (fun label -> emitter |> emitRecordLabel ~label ~debug);

analysis/src/Utils.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ let endsWith s suffix =
1515
let l = String.length s in
1616
p <= String.length s && String.sub s (l - p) p = suffix
1717

18+
let isFirstCharUppercase s =
19+
String.length s > 0 && not (Char.equal s.[0] (Char.uppercase_ascii s.[0]))
20+
1821
let cmtPosToPosition {Lexing.pos_lnum; pos_cnum; pos_bol} =
1922
Protocol.{line = pos_lnum - 1; character = pos_cnum - pos_bol}
2023

0 commit comments

Comments
 (0)