We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e64c73 commit ad8ed8bCopy full SHA for ad8ed8b
analysis/src/SemanticTokens.ml
@@ -79,6 +79,11 @@ module Token = struct
79
^ string_of_int length ^ "," ^ tokenTypeToString type_ ^ ","
80
^ tokenModifiersString)
81
82
+ let remove_trailing_comma buffer =
83
+ let len = Buffer.length buffer in
84
+ if len > 0 && Buffer.nth buffer (len - 1) = ',' then
85
+ Buffer.truncate buffer (len - 1)
86
+
87
let emit e =
88
let sortedTokens =
89
e.tokens
@@ -87,6 +92,10 @@ module Token = struct
92
in
93
let buf = Buffer.create 1 in
94
sortedTokens |> List.iter (fun t -> e |> emitToken buf t);
95
96
+ (* Valid JSON arrays cannot have trailing commas *)
97
+ remove_trailing_comma buf;
98
90
99
Buffer.contents buf
91
100
end
101
0 commit comments