Make sections of code that you 'close' stay closed

When you close a section of code in the editor, it makes the whole thing a bit easier to navigate. The only problem is that the code opens back up when you refresh the editor.
This could also be a toggle-able setting.

There is a simpler solution: do a code splitting. Just do not make a situation, when you need to collapse code segments!

For instance:

Before:

// utils.js
/**
 * Adds 1 to the given number
 * @param {number} n - Number
 */
const a = n => n + 1

/**
 * Subtracts 1 from the given number
 * @param {number} n - Number
 */
const b = n => n - 1

After:

// utils/index.js
const a = require('./a')
const b = require('./b')

module.exports = { a, b }

// utils/a.js
...a

// utils/b.js
...b
1 Like

Thanks, i will try it.

Hey @MeowCatPersonThing I can definitely understand how this can be frustrating! At the same time code folding is a very subjective feature and folks often have different, strongly-held opinions about how it should work.

It’s worth thinking about, so I’ve passed this on to the rest of the team for consideration in future planning. Don’t forget to add your own vote if you feel strongly about it!

1 Like