You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The word "_val1" at lines 7 and 8 is highlighted in green, with the following c1 in each case highlighted in red. But at line 15, only the "1" in "_val1" is highlighted green, and the c1 is just in black like most other text in the program.
If we place lines 9-13 in a block, though, like this
type cbst = Leaf | Node((value, count), cbst, cbst);
then the highlighting looks right again. On the other hand, reformatting the document (select-all, right-click, Format Document) leads to those new braces getting removed, and the coloring problem renews itself.
The text was updated successfully, but these errors were encountered:
Please include steps needed to reproduce the bug, along any relevant sections of the log file, located at
node_modules/.lsp/debug.log
The following code (written by a student solving an exam problem) shows up with peculiar formatting at line 14:
type cbst = Leaf | Node((value, count), cbst, cbst);
let rec largestCount: cbst => int =
inTree =>
switch (inTree) {
| Leaf => failwith("largestCount does not take empty CBST")
| Node((_val1, c1), Leaf, Leaf) => c1
| Node((_val1, c1), leftSide, Leaf) =>
if (c1 >= largestCount(leftSide)) {
c1;
} else {
largestCount(leftSide);
}
| Node((_val1, c1), Leaf, rightSide) => // PECULIAR FORMATTING
if (c1 >= largestCount(rightSide)) {
c1;
} else {
largestCount(rightSide);
}
| Node((_val1, c1), leftSide, rightSide) =>
if (c1 >= largestCount(leftSide) && c1 >= largestCount(rightSide)) {
c1;
} else if (largestCount(leftSide) >= c1
&& largestCount(leftSide) >= largestCount(rightSide)) {
largestCount(leftSide);
} else {
largestCount(rightSide);
}
};
The word "_val1" at lines 7 and 8 is highlighted in green, with the following c1 in each case highlighted in red. But at line 15, only the "1" in "_val1" is highlighted green, and the c1 is just in black like most other text in the program.
If we place lines 9-13 in a block, though, like this
type cbst = Leaf | Node((value, count), cbst, cbst);
let rec largestCount: cbst => int =
inTree =>
switch (inTree) {
| Leaf => failwith("largestCount does not take empty CBST")
| Node((_val1, c1), Leaf, Leaf) => c1
| Node((_val1, c1), leftSide, Leaf) =>
{ //ADDED
if (c1 >= largestCount(leftSide)) {
c1;
} else {
largestCount(leftSide);
}
} //ADDED
| Node((_val1, c1), Leaf, rightSide) =>
if (c1 >= largestCount(rightSide)) {
c1;
} else {
largestCount(rightSide);
}
| Node((_val1, c1), leftSide, rightSide) =>
if (c1 >= largestCount(leftSide) && c1 >= largestCount(rightSide)) {
c1;
} else if (largestCount(leftSide) >= c1
&& largestCount(leftSide) >= largestCount(rightSide)) {
largestCount(leftSide);
} else {
debug.log
then the highlighting looks right again. On the other hand, reformatting the document (select-all, right-click, Format Document) leads to those new braces getting removed, and the coloring problem renews itself.
The text was updated successfully, but these errors were encountered: