Miranda Code Quality
A VS Code extension that performs static analysis on Miranda source files, grouping diagnostics into three configurable quality profiles.
Features
Pattern Coverage
Detects functions with multiple equations that may have missing catch-all patterns or redundant duplicate patterns:
- Missing catch-all: warns when a multi-equation function has no wildcard (
_) or variable catch-all, meaning some inputs may be unmatched at runtime.
- Redundant patterns: warns when a literal pattern appears more than once in the same function, making later equations unreachable.
Style
Checks for common style issues:
- Function names that don't follow camelCase (starting with lowercase).
- Type constructor names that don't start with uppercase (PascalCase).
- Trailing whitespace on any line.
- Lines exceeding 100 characters.
- Mixed tabs and spaces in indentation.
Documentation
Flags functions and type definitions that lack a preceding comment:
- Functions with a type signature (
::) and no || comment above them.
- Type definitions (
::=) with no || comment above them.
A tree view in the Explorer panel shows a per-profile summary for the active Miranda file in real time:
- Each profile shows a ✓ (no issues) or ✗ N (issue count).
- Total issue count at the bottom.
Usage
- Open any file with a
.m or .mira extension — analysis runs automatically on open, save, and edit.
- Issues appear in the Problems panel (
View > Problems) with their profile label ([Pattern Coverage], [Style], [Documentation]).
- The Miranda Code Quality panel in the Explorer sidebar shows the per-profile summary.
- Run Miranda: Analyze Current File from the Command Palette (
Ctrl+Shift+P) to trigger a manual analysis.
Configuration
All profiles can be toggled independently in Settings (miranda-code-quality.*):
| Setting |
Default |
Description |
mirandaCodeQuality.enablePatternCoverage |
true |
Enable pattern coverage analysis |
mirandaCodeQuality.enableStyle |
true |
Enable style checks |
mirandaCodeQuality.enableDocumentation |
true |
Enable documentation checks |
Requirements
- VS Code 1.85 or later.
- Miranda source files with
.m or .mira extension.
Development
npm install
npm run compile
# Press F5 in VS Code to open an Extension Development Host
| |