Improve Code Readability and Navigation

Discover how to manage code visibility with code folding in Go

Try a code folding feature to enhance the readability and navigability of your Go code. This feature is especially useful for managing large codebases and focusing on the overall structure of your code.

Target Code Blocks for Folding:

  • One-line if blocks with a single return
  • One-line if blocks with a single panic
  • One-line if blocks for error handling
  • One-line functions with a single return
  • One-line case clauses
  • Formatted strings

How to use:

To fold or unfold a code block, simply click on the fold marker next to the line number or use a keyboard shortcut. You can also use ⌘- (macOS) / Ctrl+Minus (Windows/Linux) to fold and ⌘+ (macOS) / Ctrl+Plus (Windows/Linux) to unfold. Hovering over a folded code block will display a tooltip with a preview of the hidden content. This feature can be customized in settings to choose which types of blocks are foldable according to user preference.

Alt text for screenshot

New in 2023.3

Related Resources

Changing the font size in the editor
Use a keyboard shortcut to change the font size in the editor.
Create a function in another package
Type a non-existing function name and generate its implementation in a package of your choice
Empower your `Printf`-like functions with coding assistance
Provide hints and highlights for message formats in custom `Printf`-like functions