cr-analyzer¶
Lightweight LSP server for the Crystal language. cr-analyzer parses source files with the Crystal parser and builds a semantic index without invoking the full compiler, aiming for fast, editor-friendly feedback.
What works today¶
- Workspace scan of project sources,
lib, and Crystal stdlib. - Navigation: declaration, definition, type definition, implementation.
- References for locals/ivars/cvars/types/enum members/methods (arity-aware).
- Hover with signatures and docs; signature help.
- Completion: members, types/aliases/enum members, variables, keywords,
requirepaths, resolve for docs. - Rename (best-effort across workspace), document highlights, selection ranges.
- Call hierarchy (incoming/outgoing), inline values.
- Document symbols + workspace symbols.
- Diagnostics (push + pull): syntax/parser errors and lint warnings (TODO/FIXME, empty rescue, trailing whitespace, duplicate requires, missing final newline, mixed indentation, unused args).
Quick start¶
shards install
crystal run src/bin/cra.cr # or shards build && ./bin/cr-analyzer
Point your editor's LSP client to that command (stdio).
Stdlib lookup¶
Uses CRYSTAL_PATH or CRYSTAL_HOME; falls back to /usr/share/crystal/src.
Docs¶
Local docs preview¶
pip install mkdocs mkdocs-material
mkdocs serve
Roadmap snapshot¶
See the full roadmap for the long list. Next priorities often include references/call hierarchy polish, diagnostics improvements, and richer completion/hover details.