VS Code does not understand Flow type syntax and therefore gets confused by some non-js constructs when it comes to properly fold code blocks. Take this example code:
// @flow
type Ex1 = {
// this is visible but shouldn't be
foo: number,
// this is visible but shouldn't be
};
function ex2() {
// this is folded away
type foo = {| x: number |};
// this is visible but shouldn't be
}
function ex3() {
// this is folded away
function foo(x: { ... }) {}
// this is visible but shouldn't be
}
function ex4() {
// this is folded away
const foo = (x: { ... }) => null;
// this is visible but shouldn't be
}
function ex5() {
// this is folded away
function inner() {
const foo = (x: { ... }) => null;
}
// this is visible but shouldn't be
}
When using the Fold All action, some of the comments will not be hidden because
types are not blocks to VS Code (Ex1)
exact types interrupt the current block (ex2)
explicit inexact types interrupt the current block (ex3, ex4)
With nested blocks (ex5), the interruption seems to end exactly the enclosing block, derailing the ancestor blocks by one closing brace each: the inner function ends one line too early at line 39, making its closing brace at line 40 end the ex5 function.
As even in Flow all braces match up, just in non-JS ways, I'm not sure if that is something that would have to be fixed in VS Code or here; I decided to report here because it is definitely impacting the Flow development experience.
VS Code does not understand Flow type syntax and therefore gets confused by some non-js constructs when it comes to properly fold code blocks. Take this example code:
When using the
Fold All
action, some of the comments will not be hidden becauseEx1
)ex2
)ex3
,ex4
)With nested blocks (
ex5
), the interruption seems to end exactly the enclosing block, derailing the ancestor blocks by one closing brace each: theinner
function ends one line too early at line 39, making its closing brace at line 40 end theex5
function.As even in Flow all braces match up, just in non-JS ways, I'm not sure if that is something that would have to be fixed in VS Code or here; I decided to report here because it is definitely impacting the Flow development experience.