Skip to content

Commit

Permalink
Fold statements from the end of their first line, not first token
Browse files Browse the repository at this point in the history
FIX: Make statement folding leave the entire first line visible.

See https://discuss.codemirror.net/t/configure-code-folding-to-preserve-first-line/8178
  • Loading branch information
marijnh committed Apr 30, 2024
1 parent 176496f commit 9bf24c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let parser = baseParser.configure({
Statement: continuedIndent()
}),
foldNodeProp.add({
Statement(tree) { return {from: tree.firstChild!.to, to: tree.to} },
Statement(tree, state) { return {from: Math.min(tree.from + 100, state.doc.lineAt(tree.from).to), to: tree.to} },
BlockComment(tree) { return {from: tree.from + 2, to: tree.to - 2} }
}),
styleTags({
Expand Down

0 comments on commit 9bf24c8

Please sign in to comment.