Skip to content
Discussion options

You must be logged in to vote

Folding for round brackets was disabled intentionally. I have though about changing this.

In the mean time, if you want folding for round brackets, you can add a FoldingRangeProvider for it like so:

import { readOnlyCodeFolding, FoldingRangeProvider } from "prism-code-editor/code-folding"
import "prism-code-editor/code-folding.css"

const isMultiline = (str: string, start: number, end: number) => str.slice(start, end).includes("\n")

const roundBracketFolding: FoldingRangeProvider = editor => {
  const matchBrackets = editor.extensions.matchBrackets
  const folds: [number, number][] = []
  const value = editor.value

  if (matchBrackets) {
    const { brackets, pairs } = matchBrackets
    f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ysk3a
Comment options

Answer selected by ysk3a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants