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

推荐订阅源

GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
博客园 - 【当耐特】
D
Docker
Y
Y Combinator Blog
L
LangChain Blog
博客园 - 三生石上(FineUI控件)
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
B
Blog
The GitHub Blog
The GitHub Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
爱范儿
爱范儿
A
About on SuperTechFans
量子位
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

Show HN

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). Release v0.1.2.1 · kouhxp/yapsnap GitHub - noopolis/moltnet: Self-hostable chat network for AI agents. Pre-built bridges for Claude Code, Codex, and the Claws. Rooms, DMs, history. No Slack bots, no Matrix, no glue code.
GitHub - tree-sitter-perl/perl-lsp: perl-lsp — a fast Per...
rabbiveesh · 2026-06-23 · via Show HN

A Perl language server with deep semantic intelligence. Built on tree-sitter-perl and tower-lsp.

crates.io CI VS Code License

perl-lsp: cross-file type inference, completion, goto-def and rename

Hover infers $acct is an Account through the imported make_account(); goto-def jumps into Bank.pm; completion lists the class's methods; renaming the accessor cascades across files. (demo/)

Install

Editor Setup

VS Code

Install Perl (perl-lsp) from the Marketplace (or search perl-lsp in the Extensions view). The extension fetches the matching perl-lsp binary automatically — no separate cargo install needed. To point it at your own build instead, set perl-lsp.path in settings.

The cargo install above is only needed for the other editors below, or if you prefer to manage the binary yourself.

Neovim (0.11+)

vim.lsp.config["perl-lsp"] = {
  cmd = { "perl-lsp" },
  filetypes = { "perl" },
  root_markers = { "cpanfile", "Makefile.PL", "Build.PL", ".git" },
}
vim.lsp.enable("perl-lsp")

Neovim (0.10 or earlier)

vim.api.nvim_create_autocmd("FileType", {
  pattern = "perl",
  callback = function()
    vim.lsp.start({
      name = "perl-lsp",
      cmd = { "perl-lsp" },
      root_dir = vim.fs.root(0, { "cpanfile", "Makefile.PL", "Build.PL", ".git" }),
    })
  end,
})

Helix

Add to ~/.config/helix/languages.toml:

[language-server.perl-lsp]
command = "perl-lsp"

[[language]]
name = "perl"
language-servers = ["perl-lsp"]

Emacs (eglot)

(add-to-list 'eglot-server-programs '(perl-mode . ("perl-lsp")))

Claude Code

perl-lsp is published to the Piebald LSP marketplace, giving Claude Code real-time Perl intelligence (type inference, navigation, framework awareness). With perl-lsp on your PATH, add the marketplace and install the plugin:

/plugin marketplace add Piebald-AI/claude-code-lsps
/plugin install perl-lsp@claude-code-lsps

The server starts automatically when you open a Perl file. The plugin is configuration only — it speaks to the perl-lsp you installed above and downloads nothing on its own.

Semantic Token Colors (Neovim)

perl-lsp emits rich semantic tokens. Add these to your config for the best experience:

vim.api.nvim_set_hl(0, "@lsp.type.macro.perl", { link = "Keyword" })      -- has, with, extends
vim.api.nvim_set_hl(0, "@lsp.type.property.perl", { link = "Identifier" }) -- hash keys
vim.api.nvim_set_hl(0, "@lsp.type.namespace.perl", { link = "Type" })     -- Foo::Bar
vim.api.nvim_set_hl(0, "@lsp.type.parameter.perl", { link = "Special" })  -- sub params
vim.api.nvim_set_hl(0, "@lsp.type.keyword.perl", { link = "Constant" })   -- $self/$class
vim.api.nvim_set_hl(0, "@lsp.mod.scalar.perl", { fg = "#61afef" })        -- $ blue
vim.api.nvim_set_hl(0, "@lsp.mod.array.perl", { fg = "#c678dd" })         -- @ purple
vim.api.nvim_set_hl(0, "@lsp.mod.hash.perl", { fg = "#e5c07b" })          -- % gold
vim.api.nvim_set_hl(0, "@lsp.mod.modification.perl", { fg = "#e06c75" })  -- writes in red
vim.api.nvim_set_hl(0, "@lsp.mod.declaration.perl", { bold = true })
vim.api.nvim_set_hl(0, "@lsp.mod.readonly.perl", { italic = true })
vim.api.nvim_set_hl(0, "@lsp.mod.defaultLibrary.perl", { italic = true }) -- imported functions

Features

Type Inference

No annotations needed. perl-lsp infers types from how your code uses values:

  • Foo->new()$obj is ClassName(Foo)
  • $obj->{key}$obj is HashRef
  • $x + 1$x is Numeric
  • Method chains propagate: $self->get_config()->{host} resolves through return types
  • Cross-file: return types and parameter types flow across module boundaries

Framework Intelligence

Framework What perl-lsp understands
Moo/Moose has accessor synthesis with is/isa type mapping, getter/setter arity, extends/with for inheritance and roles
Mojo::Base Accessor synthesis with default value type inference, fluent setter chaining, parent class detection
DBIC add_columns column accessors, has_many/belongs_to/has_one relationship accessors, load_components mixin resolution
Perl 5.38 class field with :param/:reader/:writer, :isa(Parent), :does(Role), implicit $self

Framework DSL keywords (has, with, extends, around, etc.) are recognized and won't trigger unresolved-function diagnostics.

Constant Folding + Dynamic Dispatch

my $method = "get_$field";
$self->$method();          # goto-def works — resolves through the constant

perl-lsp folds use constant, package-scope variables, string interpolation, and loop variables. Dynamic method calls via $self->$var() resolve to their targets.

Cross-File Intelligence

  • Module resolution from @INC + cpanfile dependencies
  • Auto-discovers lib/ and local/lib/perl5/ relative to workspace root — no PERL5LIB needed for standard project layouts (cpm, carton, plain lib/)
  • Inheritance chain walking (DFS, roles, mixins, load_components)
  • Return type and parameter type propagation across files
  • Cross-file rename: 289 edits across 56 files in Mojolicious in <1 second
  • SQLite cache for instant repeat resolution
  • Workspace indexing via Rayon: 274-file Mojolicious in 204ms

Module Discovery

perl-lsp finds your modules automatically:

  1. lib/ and local/lib/perl5/ in your project root (auto-discovered)
  2. @INC from your Perl installation (via perl -e 'print join "\n", @INC')
  3. PERL5LIB if set in your environment
  4. cpanfile dependencies pre-resolved at startup

For non-standard layouts, set PERL5LIB before launching your editor:

PERL5LIB=./my-libs/perl5 nvim lib/MyApp.pm

LSP Capabilities

Capability Highlights
Completion Variables, methods (type-inferred), hash keys, auto-import, module names on use lines, import lists in qw()
Go-to-definition Scope-aware variables, cross-file methods via inheritance, hash keys through expression chains
Find references Scope-aware variables, cross-file functions/methods/packages
Rename Variables (scope-aware), functions/methods/packages (cross-file via workspace index)
Hover Types, POD docs (tree-sitter-pod AST), signatures, class provenance
Signature help Parameter names with inferred types, cross-file parameter types
Semantic tokens 10 types (variable, parameter, $self, function, method, macro, property, namespace, regexp, constant), 9 modifiers
Inlay hints Variable type annotations, sub return types
Diagnostics Unresolved function/method hints with framework awareness (low-severity by design — dynamic Perl is common)
Code actions Auto-import for unresolved functions
Workspace symbol Search across all indexed project files
Document symbols Nested outline with packages, subs, classes, fields
Formatting perltidy (full document + range)
Highlights Read/write distinction
Selection range Tree-sitter node hierarchy
Folding Blocks, subs, classes, POD
Linked editing Simultaneous editing of references in scope

POD Documentation

POD is rendered via tree-sitter-pod — proper AST walk, not regex. Handles nested lists, =begin/=end data regions, multi-angle-bracket formatting (C<<< $hash->{key} >>>), bold-italic nesting, L<> links to metacpan, and =item-based method documentation.

CLI Tools

perl-lsp doubles as a command-line analysis toolkit:

# Batch diagnostics (CI-ready — resolves imports, uses SQLite cache)
perl-lsp --check [<root>] [--severity error|warning] [--format json|human]

# Code exploration
perl-lsp --outline <file>
perl-lsp --hover [<root>] <file> <line> <col>   # <root> enables cross-file hover
perl-lsp --type-at <file> <line> <col>
perl-lsp --definition <root> <file> <line> <col>
perl-lsp --references <root> <file> <line> <col>

# Refactoring
perl-lsp --rename <root> <file> <line> <col> <new_name>
perl-lsp --workspace-symbol <root> <query>

--check resolves modules from @INC, uses the per-project SQLite cache, and exits with code 1 if issues are found. Integrate into CI with:

perl-lsp --check . --severity warning

Plugins

Framework intelligence (Mojolicious, Minion, …) ships as bundled Rhai plugins. You can add your own: drop any *.rhai file into your project's .perl-lsp/ directory — auto-discovered at the workspace root, no configuration needed — and restart the server. For a personal collection you want loaded across every project, point $PERL_LSP_PLUGIN_DIR at it instead; both directories are searched. Plugin sources are fingerprinted, so editing one invalidates the cross-file cache automatically.

Generating a plugin for an Import::Base kit

Most Perl shops centralize their import boilerplate behind a kit (use Co::Base -Class;). perl-gen/ is a Perl script that reads such a kit's @IMPORT_MODULES / %IMPORT_BUNDLES tables and emits a ready-to-commit .rhai plugin so the LSP understands what the kit imports:

perl-gen/bin/perl-lsp-gen-importbase Co::Base::Local \
  --lib /path/to/project/lib \
  --alias Co::Base \
  --out "$PERL_LSP_PLUGIN_DIR/co-base.rhai"

See perl-gen/README.md for full usage and docs/adr/importbase-plugin-gen.md for the design rationale.

Building from Source

git clone https://github.com/tree-sitter-perl/perl-lsp
cd perl-lsp
cargo build --release

Testing

cargo test                                    # 900+ unit tests
cargo build --release && ./e2e/run.sh         # 10 nvim-driven e2e suites (requires nvim)

License

MIT