Description
According to the spec can return FoldingRange[] | null
, but it does not explicitly mention whether []
(empty FoldingRange) and null
are semantically distinct yet.
Empirically, I am guessing []
means there is no folding range (so editor may remove all existing folding ranges) while null
translates into provideFoldingRanges returning null
or undefined
(so editor will not use the info from the language server) . It would be nice if the spec explicitly clarifies the semantic differences.
And, VS Code question while we are here: if a language server responds with 'null' or an error, what does VS Code do - remove all the folding ranges from the previous responses, or keep the folding range info from the previous successful, non-null response until the next successful response is received?