Skip to content

Constrictor is a lightweight VS Code extension for folding Python code semantically and quickly, allowing you to reduce visual noise without losing context.

License

Notifications You must be signed in to change notification settings

disousa/constrictor

Repository files navigation

Constrictor

Constrictor is a lightweight VS Code extension for folding Python code semantically and quickly, allowing you to reduce visual noise without losing context.

It provides folding and unfolding commands based on semantic information.

Designed for calm, intentional navigation of large Python files.


Features

Constrictor adds commands to fold and unfold specific structural elements in Python files:

  • Functions
  • Methods
  • Classes
  • Docstrings
  • Full document fold that reduces the file to its essential structure

All folding operations:

  • Work recursively (nested blocks included)
  • Never fold the region containing the cursor
  • Operate on the entire file
  • Run silently without moving the cursor

Commands

All commands are available from the Command Palette (Cmd+Shift+P / Ctrl+Shift+P).

Folding

  • Constrictor: Fold Functions
  • Constrictor: Fold Methods
  • Constrictor: Fold Classes
  • Constrictor: Fold Docstrings
  • Constrictor: Fold Document

Unfolding

  • Constrictor: Unfold Functions
  • Constrictor: Unfold Methods
  • Constrictor: Unfold Classes
  • Constrictor: Unfold Docstrings

Design Philosophy

Constrictor is intentionally minimal:

  • No settings
  • No state
  • No UI
  • No surprises

It is meant to stay out of your way and give you control over visual structure when you want it.


Language and LSP Support

  • Python only
  • Designed with Pylance in mind; other Python language servers or symbol providers have not been tested and may behave differently.

Constrictor relies on VS Code’s document symbol provider and does not use indentation-based heuristics.


Known Limitations

  • Multiple definitions in the same scope: If a symbol is defined more than once in the same scope (e.g., via method/function overloads or @property getters/setters), only the last instance will be folded. This is due to how VS Code’s document symbol provider reports symbols.

License

This project is licenced under the MIT License.

About

Constrictor is a lightweight VS Code extension for folding Python code semantically and quickly, allowing you to reduce visual noise without losing context.

Resources

License

Stars

Watchers

Forks

Packages

No packages published