惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS Blog

Show HN

GitHub - astefanutti/shaderbang: Shebang for Shaders Show HN: Generate Claude Code Workflows using Spec Driven Development approach Show HN: AI agents for UK GDAD PCF roles and their skills The Two Pillars: Mixer Mode and Meta-Software in the Reorganization of Software Work After AI GitHub - JaiCode08/teleport-env What 1,000+ Harness Experiments Taught Me About Self-Improving Agents Show HN: Liiists, a Markdown-first, iOS and CLI list app SwiperTab – Get this Extension for 🦊 Firefox (en-US) GitHub - kouhxp/fftext: Summarize, explain, fact-check, or translate any text, URL, or file. No GPU. No cloud. One command GitHub - sweetpad-dev/sweetpad: Develop Swift/iOS projects using VSCode GitHub - dogmaticdev/IRON: IRON a.k.a. Intermediate Representation Object Notation is a Interpreter/Database that is used to create Programming Languages. GitHub - sjhalani7/vaen: Package your AI coding harness into a portable .agent file, and share it across repos, teams, & the community without ever having to copy-paste instructions, skills, MCP config, or secrets. Show HN: Gandalf the Grader Show HN: Citadeld – replay any CI failure locally from a single file GitHub - tdortman/cuSBF: High-Performance GPU Super Bloom Filter coral-ai/claude-code-token-xray at main · Coral-Bricks-AI/coral-ai GitHub - ulyssestenn/funes: Funes is a Git-based framework for LLM-managed knowledge work: an AI Librarian ingests raw sources, builds an interlinked Markdown knowledge base, and uses it to produce cited reports, analyses, and other outputs. GitHub - ThatXliner/gah: Git Add Hunk, built for agents to use GitHub - harmont-dev/harmont-cli: Command-line client for the Harmont CI platform GitHub - brooksmcmillin/mcp-authflow: OAuth 2.0 Authorization Server framework for MCP servers GitHub - javaid-codes/audit-supply-chain-agents GitHub - amorey/gochan: A small library of common channel architectures for Go, inspired by Rust GitHub - arifozgun/OpenGem: Free, Open-Source AI API Gateway with Gemini, OpenAI & Anthropic Compatibility in 1 file GitHub - Pranesh950/BioPetals: 🌸 Run BIOxAI models at home, BitTorrent-style. Fine-tuning and inference up to 10x faster than offloading GitHub - cnguyen14/bounty-doctor: Diagnose a GitHub bounty issue before you waste hours: detects honeypot scam repos, AI-bot attempt swarms, and stale contests. Show HN: CoreMCP – MCP Server for On-Prem DBs Show HN: KittyHTML – Render HTML/CSS as an inline image in your terminal GitHub - bingud/filemat: Web-based file manager Show HN: TruthLens – Free multi-signal deepfake image detector GitHub - apexlocal-jz/claude-usage-tray: Windows system-tray app showing your Claude Code rate-limit usage at a glance. Zero deps, ~300 lines of PowerShell. Cross-IDE (works regardless of VS Code, Cursor, plain terminal).
GitHub - markosnarinian/fold-logging.nvim: Automatically ...
markosn · 2026-06-22 · via Show HN

Automatically fold logging and debug-print statements without changing the rest of your folding setup.

Overview

def compute(values):
    logger.debug(···)          # ← folded
    total = sum(values)
    print(···)                 # ← folded
    return total               #   the function itself stays unfolded
  • Closes logging folds when a supported file opens.
  • Preserves your existing expr folds for functions, classes, and blocks.
  • Works with Treesitter folds, LSP folds, and nvim-origami.
  • Supports Python out of the box; other languages can be configured with Lua patterns.

Installation

Requires Neovim 0.10+ and expr-based folding, usually Treesitter or LSP. The plugin composes logging folds on top of that base fold expression instead of replacing it.

With lazy.nvim

{
  "markosnarinian/fold-logging.nvim",
  ft = { "python" },
  cmd = { "FoldLoggingFold", "FoldLoggingUnfold", "FoldLoggingToggle", "FoldLoggingList" },
  opts = {},
}

Add each configured language to ft so lazy.nvim loads the plugin for that filetype.

Usage

By default, logging folds are created and closed automatically when a supported file opens. You can also control them manually:

Command Action
:FoldLoggingFold Close logging folds in the current buffer.
:FoldLoggingUnfold Open logging folds in the current buffer.
:FoldLoggingToggle Toggle logging folds in the current buffer.
:FoldLoggingRefresh Recompute logging folds after edits.
:FoldLoggingList List detected calls in the quickfix window.
:FoldLoggingEnable Re-enable and attach to open buffers.
:FoldLoggingDisable Disable and restore previous folding.

Configuration

Pass options through opts (or require("fold-logging").setup{}). Defaults:

{
  enable = true,            -- master switch
  auto_fold = true,         -- fold automatically on open
  fold_single_line = false, -- also fold lone one-line calls (sets foldminlines=0)
  min_lines = 1,            -- only fold regions spanning >= this many lines
  notify = true,            -- emit vim.notify messages
  base_foldexpr = nil,      -- general-fold source; nil auto-detects Treesitter/LSP
  languages = {},           -- deep-merged over the built-ins
}

If you use LSP folds and auto-detection does not pick them up, set:

opts = {
  base_foldexpr = vim.lsp.foldexpr,
}

What gets folded

For Python, the built-in rules fold:

  • print(...)
  • pprint(...)
  • calls ending in a standard log level: .debug, .info, .warning, .warn, .error, .critical, .exception, .fatal, .log

Setup calls such as logging.basicConfig(...) and logging.getLogger(...) are not folded.

Adding a language

Languages are keyed by Neovim filetype. A language spec contains:

  • call_node_types: Treesitter node types that represent calls
  • patterns: Lua patterns matched against the called function name
opts = {
  languages = {
    go = {
      call_node_types = { "call_expression" },
      patterns = { "^fmt%.Print", "^log%.", "%.Debug$", "%.Info$" },
    },
  },
}

Patterns match the callee text, not the full source line. For example, "%.Info$" matches log.Info(...) and logger.Info(...).

Use :InspectTree to find the call node type for a language.

API

local fl = require("fold-logging")

fl.setup(opts)    -- configure (lazy does this via `opts`)
fl.fold(bufnr)    -- close logging folds (bufnr optional, defaults to current)
fl.unfold(bufnr)  -- open logging folds
fl.toggle(bufnr)  -- toggle
fl.refresh(bufnr) -- recompute
fl.list(bufnr)    -- quickfix list of detections
fl.detect(bufnr)  -- -> { { start = <lnum>, ["end"] = <lnum>, text = <callee> }, ... }
fl.enable()       -- re-enable at runtime
fl.disable()      -- disable and restore folding

Contributing

Issues and pull requests are welcome.

License

MIT