sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Feature request: Add code folding support on the code-editor component

Open bentleyvk opened this issue 3 years ago • 1 comments

Tell us how you think we can improve Sandpack

Packages affected

  • [ ] sandpack-client
  • [x] sandpack-react

What is this feature?

It would be nice to have code folding as Codemirror already supports that https://github.com/codemirror/fold. Also to control what lines are initially folded.

How would your idea work?

There should be an arrow next to line number that folds the code like this: image

Do you have any examples of how you would like to see us implement it?

https://codemirror.net/demo/folding.html

bentleyvk avatar Mar 03 '22 08:03 bentleyvk

I have added your feature request to our internal backlog which we use to prioritize what to build next. We can't make any promises about the timing, but it's on the list!

If you'd like to work on this feature with us, please create a pull request and we'll help you along the way.

For others landing on this issue, feel free to add more context or simply leave a thumbs up 👍 on this comment if you find this feature useful.

danilowoz avatar Mar 07 '22 17:03 danilowoz

Sandpack aims to provide an essential but powerful editing experience. That said, we're not considering adding this feature because it can't be considered critical in most cases when using Sandpack. Plus, this can be manually added using the extension API:

<Sandpack
  options={{
    codeEditor: {
      extensions: [codemirrorExtension()],
    },
  }}
  template="react"
/>

https://sandpack.codesandbox.io/docs/advanced-usage/components#extensions

danilowoz avatar Jan 04 '23 15:01 danilowoz