pain001.lsp package#
Language Server Protocol support for Pain001 payment CSV files.
The pain001.lsp.diagnostics module holds the pure, dependency-free
diagnostic engine (testable without any LSP runtime). pain001.lsp.server
wires it to an editor over stdio using pygls (install the lsp extra).
Submodules#
pain001.lsp.diagnostics module#
Pure diagnostic engine for Pain001 payment CSV documents.
This module has no LSP or editor dependencies, so it can be unit-tested in
isolation and reused anywhere (the CLI, CI linters, the LSP server). Given
the raw text of a CSV file it returns a list of Diagnostic objects
locating problems that would make the file fail ISO 20022 generation —
missing required columns and malformed IBAN/BIC/currency cells — by reusing
the same validators the generator uses.
- class pain001.lsp.diagnostics.Diagnostic(line: int, col_start: int, col_end: int, severity: Severity, message: str, code: str)[source]#
Bases:
objectA single editor diagnostic over a 0-based line/character range.
- Variables:
line (int) – Zero-based line index of the affected text.
col_start (int) – Zero-based start character on the line.
col_end (int) – Zero-based end character (exclusive) on the line.
severity (pain001.lsp.diagnostics.Severity) – Diagnostic severity.
message (str) – Human-readable description of the problem.
code (str) – Stable machine-readable rule identifier.
- code: str#
- col_end: int#
- col_start: int#
- line: int#
- message: str#
- class pain001.lsp.diagnostics.Severity(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumDiagnostic severity, matching the LSP numeric scale.
- ERROR = 1#
- HINT = 4#
- INFORMATION = 3#
- WARNING = 2#
- pain001.lsp.diagnostics.diagnostics_for_csv(text: str, message_type: str = 'pain.001.001.03') list[Diagnostic][source]#
Lint a payment CSV document and return diagnostics.
- Parameters:
text – The full text of the CSV document.
message_type – ISO 20022 message type the file targets.
- Returns:
A list of
Diagnosticobjects (empty when the file is clean or has no header row).
pain001.lsp.server module#
Language Server (stdio) for Pain001 payment CSV files.
Wraps the pure pain001.lsp.diagnostics engine in a pygls server
so editors get live IBAN/BIC/currency/charset and missing-column diagnostics
as they type. Run it with pain001-lsp after pip install "pain001[lsp]".
- pain001.lsp.server.did_change(ls: LanguageServer, params: DidChangeTextDocumentParams) None[source]#
Re-lint a document when it changes.
- Parameters:
ls – The active language server.
params – The change-document notification parameters.