• Packages
  • Themes
  • Documentation
  • Blog
  • Discussions
Sign in

atom-folding

Custom code folding support for Atom
  • #folding
Aerijo
0.0.9 5,843
1
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

atom-folding

A service to add custom folding rules to Atom

This package overrides core folding methods, but never modifies / deletes text itself (providers are separate packages and their behaviour is not guaranteeded by this statement). All changes are visual and will be reset if the tab is closed. Having said that, please always make a backup of your files.

Featured providers

  • latex-folding
  • folding-markdown

API

Still in development, but this is how it currently works. A provider must be an object with the following interface (TypeScript). Note that the methods are called by Atom, not this package. All this package does is replace the existing methods on the editor's languagemode.

interface FoldProvider {
  allowDefaultFolds?: boolean; // if your method returns a falsey result, the original method will be tried
  isFoldableAtRow (params: IsFoldableParams): boolean; // called a lot; used to add the fold carets to the gutter
  getFoldableRangeContainingPoint (params: GetPointFoldableParams): Range | undefined;
  getFoldableRangesAtIndentLevel (params: GetIndentFoldableParams): Range[] | undefined;
  destroy? (): void; // use this to clean up any subscriptions. Note it will be called multiple times if you have the same provider for multiple root scopes
}

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by