HVP Language Support
VS Code support for the HVP (Hierarchical Verification Plan) language used by Synopsys
Verification Planner.
This extension is a thin LSP client. All language intelligence (parsing, diagnostics,
completion, outline, folding) lives in the standalone hvp-language-server npm package
(sibling repo, ../hvp-language-server); this repo only wires that server into VS Code
and ships a generated TextMate grammar for syntax highlighting. See CLAUDE.md in this
folder for the file-by-file map.
Features
- Syntax highlighting for
.hvp files (keywords, types, built-in metrics, strings,
numeric/percent literals, comments) — syntaxes/hvp.tmLanguage.json, generated by
hvp-language-server's grammar generator (see "Syntax grammar" below). Inside a
source = "..." string the Table 4 keyword prefix (group instance bin:,
property categoryMask 'h00f:, …), the `r`/`n`/`-` tags, the
?/*/** wildcards and ${name} are scoped separately from the string; so are
enum {...} members, aggregate {X(weight=...)} members and #(...) subplan
parameters.
- Feature outline: the Outline view and "Go to Symbol" (
Ctrl+Shift+O) list every
feature block, nested to match the file's actual feature ... endfeature hierarchy.
Only features are shown — measures, metrics, plans, subplans, overrides, and filters are
intentionally excluded.
- Block snippets: typing a block-opener keyword (
plan, feature, metric, measure,
override, filter, until) and accepting the suggestion inserts the full
<keyword> <name>; ... end<keyword> skeleton with tabstops. Sent by the server as
insertTextFormat: Snippet completion items — there's no local snippets/hvp.json file
anymore.
- Autocompletion: block keywords, built-in attributes/annotations (
description, weight,
owner, at_least, source, test.expected), built-in metric names (Line,
Group, test.*, etc.), type keywords, and aggregator names — all offered everywhere, but
ranked by what block the cursor is currently inside (e.g. source sorts first inside a
measure, measure/metric sort first inside a feature). Suppressed inside strings and
comments. Triggers automatically after . (for dotted names like test.expected).
The attributes and annotations the current plan declares are offered too, and after
name = the members of that name's enum type are offered first.
- Hover:
- On a
feature (or plan) name — a table of every attribute and annotation visible
there, with its effective value and where that value came from: the declaration
default, or an assignment in this feature or an ancestor. Each origin is a link to
the line it came from. Attributes inherit down the feature hierarchy; annotations
only take an assignment in the feature itself.
- On an assignment's left-hand side — the declaration it resolves to, its default, and
the value in effect at that point.
- On an attribute, annotation or metric declaration name — its declared shape.
- Auto-indentation: all seven block openers (
plan, feature, metric, measure,
override, filter, until) increase the indent of the next line, and their end...
keywords decrease it. elseuntil/else do both: they outdent themselves and indent the
branch that follows. A line that opens and closes a block on itself
(measure Line m; source = "x"; endmeasure) changes nothing
(language-configuration.json, client-side).
- Block folding: every
plan/feature/metric/measure/override/filter/until block
can be folded, from the server's foldingRangeProvider.
- Problems (diagnostics), refreshed as you type (debounced 300ms server-side):
- Error — a statement line doesn't end with a
; (block closers like endfeature/
endmeasure/endmetric/endoverride/endfilter/endplan/enduntil are exempt, and a
line ending in , is treated as a continued list, e.g. a multi-line source = "...", "...";).
- Error — block imbalance, treating every block pair (
plan/endplan,
feature/endfeature, metric/endmetric, measure/endmeasure,
override/endoverride, filter/endfilter, until/enduntil) like matching
parentheses: an unclosed block left open at end of file, a close keyword with no matching
open, or a close keyword that doesn't match the innermost open block.
- Warning — a
feature block has no nested features and no measures.
- Warning — a
measure block has no source assignment.
- Error — an assignment's left-hand side is not an attribute, annotation or metric
the plan declares (a metric on the left-hand side is a goal override, not an error).
- Error — a declaration default or an assigned value doesn't match the declared
type, including a value that is not a member of the declared
enum.
Settings
hvp.server.path — path to a local hvp-language-server launcher, for developing against
a build other than the bundled one. Empty uses the bundled server.
hvp.trace.server — traces the client/server conversation (off, messages, verbose).
hvp.modifiers.files — modifier files to preview, named as the tool's -mod argument list
would: a file: URI, an absolute path, or a path relative to a workspace folder. When set,
override statements are applied to the values shown on hover, and features a filter
removes are marked as removed. Empty (the default) shows the plan as written.
hvp.modifiers.date — the date until branches are evaluated against, as MM-DD-YYYY
(the format the language chapter's own examples use). Empty uses today.
Known limitations (v1)
- Coverage scores are not shown. They need an annotated database from the Synopsys tools,
which is outside what an editor can see.
License
MIT
| |