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

推荐订阅源

S
SegmentFault 最新的问题
J
Java Code Geeks
V
V2EX
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
B
Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
美团技术团队
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
N
Netflix TechBlog - Medium
C
Check Point Blog
Recent Announcements
Recent Announcements
博客园 - Franky
博客园 - 叶小钗
T
Tailwind CSS Blog

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - markosnarinian/fold-logging.nvim: Automatically ...
markosn · 2026-06-22 · via Hacker News: 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