@venn-lang/lsp 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-CS9hyKZX.mjs","names":["kindOf","kindOf","signatureOf","rootOf","importedDecos","collect","rootOf","declares","pathOf","segmentAt","nodeAt","walk","rootOf","importedNames","kindOf","lineStart","returnOf","optionLine","KEYWORDS","FRAGMENT","BUILT_IN","kindOf","EXTENSION","MAX_DEPTH","SKIP","walk","read","declared","rangeOf","rootOf","ORIGIN","spread","argumentsBlock","leafAt","pathOf","rangeOf","rangeOf","rangeOf","emit","pathOf","pathOf","DECLARATION","MAX_DEPTH","read","pathOf"],"sources":["../src/catalog/build-catalog.ts","../src/deco/builtin-docs.ts","../src/deco/kind-of.ts","../src/deco/builtin-decos.ts","../src/docs/parse-doc.ts","../src/docs/read-doc.ts","../src/markdown/markdown.ts","../src/docs/render-doc.ts","../src/deco/declared-deco.ts","../src/deco/decos-in-scope.ts","../src/deco/imported-decos.ts","../src/deco/render-deco.ts","../src/document/exported-names.ts","../src/document/find-binding.ts","../src/document/expression-path.ts","../src/document/interpolation-at.ts","../src/document/host-at.ts","../src/document/imported-modules.ts","../src/document/imported-names.ts","../src/document/names-in-scope.ts","../src/document/resolve-fragment.ts","../src/document/resolve-imported.ts","../src/env/env-vars.ts","../src/env/render-env.ts","../src/signature/action-call.ts","../src/signature/bare-call.ts","../src/signature/call-shape.ts","../src/signature/declared-shape.ts","../src/signature/paren-call.ts","../src/signature/render-shape.ts","../src/signature/shape-at.ts","../src/signature/signature-help.ts","../src/completion/icons.ts","../src/completion/items.ts","../src/completion/argument-items.ts","../src/completion/context.ts","../src/completion/read-from.ts","../src/completion/member-items.ts","../src/completion/module-paths.ts","../src/completion/options-map-items.ts","../src/completion/type-name-items.ts","../src/completion/completion.ts","../src/definition/definition.ts","../src/formatting/formatter.ts","../src/effects/waiting-fns.ts","../src/hover/keywords.ts","../src/hover/render-symbol.ts","../src/hover/render-action.ts","../src/hover/type-hover.ts","../src/hover/render-decl.ts","../src/hover/render-imported.ts","../src/hover/render-type-name.ts","../src/hover/resolve-symbol.ts","../src/hover/hover.ts","../src/references/occurrence-range.ts","../src/references/name-property.ts","../src/references/occurrences.ts","../src/references/symbol-at.ts","../src/references/document-highlight.ts","../src/references/symbol.types.ts","../src/references/find-occurrences.ts","../src/references/references.ts","../src/rename/declares-deco.ts","../src/rename/rename.ts","../src/semantic/highlight-calls.ts","../src/semantic/highlight-keywords.ts","../src/semantic/highlight-interpolation.ts","../src/semantic/highlight-paths.ts","../src/semantic/highlight-literals.ts","../src/semantic/highlight-module.ts","../src/semantic/highlight-names.ts","../src/semantic/semantic-tokens.ts","../src/code-actions/anchor.ts","../src/code-actions/exporting-modules.ts","../src/code-actions/code-actions.ts","../src/symbols/document-symbols.ts","../src/types/type-service.ts","../src/types/warm-types.ts","../src/validation/check-validator.ts","../src/workspace/import-resolver.ts","../src/services/venn-lsp-module.ts","../src/server/start-server.ts"],"sourcesContent":["import type { PluginDefinition } from \"@venn-lang/sdk\";\nimport type { ActionEntry, MatcherEntry, SymbolCatalog, TypeEntry } from \"./catalog.types.js\";\n\ninterface Index {\n actions: Map<string, ActionEntry>;\n matchers: Map<string, MatcherEntry>;\n byNamespace: Map<string, ActionEntry[]>;\n typesByNamespace: Map<string, TypeEntry[]>;\n packages: Map<string, string>;\n}\n\n/**\n * Index the loaded plugins so completion, hover and tokens can look symbols up.\n *\n * @param plugins The plugin definitions loaded for the workspace.\n * @returns A read-only view over their actions, matchers and published types.\n */\nexport function buildCatalog(plugins: readonly PluginDefinition[]): SymbolCatalog {\n const index: Index = {\n actions: new Map(),\n matchers: new Map(),\n byNamespace: new Map(),\n typesByNamespace: new Map(),\n packages: new Map(),\n };\n for (const plugin of plugins) addPlugin(plugin, index);\n return view(index, plugins);\n}\n\nfunction view(index: Index, plugins: readonly PluginDefinition[]): SymbolCatalog {\n return {\n namespaces: () => [...index.byNamespace.keys()],\n packages: () => plugins.map((plugin) => plugin.name),\n hasNamespace: (namespace) => index.byNamespace.has(namespace),\n actionsIn: (namespace) => index.byNamespace.get(namespace) ?? [],\n action: (namespace, name) => index.actions.get(`${namespace}.${name}`),\n typesIn: (namespace) => index.typesByNamespace.get(namespace) ?? [],\n matchers: () => [...index.matchers.values()],\n matcher: (name) => index.matchers.get(name),\n namespaceOfPackage: (pkg) => index.packages.get(pkg),\n packagesFor: (namespace) =>\n [...index.packages.entries()]\n .filter(([, contributed]) => contributed === namespace)\n .map(([pkg]) => pkg),\n };\n}\n\nfunction addPlugin(plugin: PluginDefinition, index: Index): void {\n index.packages.set(plugin.name, plugin.namespace);\n const list = index.byNamespace.get(plugin.namespace) ?? [];\n index.byNamespace.set(plugin.namespace, list);\n for (const action of plugin.actions ?? []) {\n const entry = { namespace: plugin.namespace, name: action.name, package: plugin.name, action };\n index.actions.set(`${plugin.namespace}.${action.name}`, entry);\n list.push(entry);\n }\n for (const matcher of plugin.matchers ?? []) {\n index.matchers.set(matcher.name, { name: matcher.name, package: plugin.name, matcher });\n }\n addTypes(plugin, index);\n}\n\n/** A namespace offers its published types alongside its verbs: `http.Request`. */\nfunction addTypes(plugin: PluginDefinition, index: Index): void {\n const entries = Object.entries(plugin.typeDefs ?? {});\n if (entries.length === 0) return;\n const list = index.typesByNamespace.get(plugin.namespace) ?? [];\n for (const [name, spec] of entries) {\n list.push({ namespace: plugin.namespace, name, package: plugin.name, spec });\n }\n index.typesByNamespace.set(plugin.namespace, list);\n}\n","/**\n * What each decorator the language documents is for, per spec §08.\n *\n * Longer than the one-line `doc` a `DecoratorDefinition` carries, because a\n * hover is where someone actually reads it. A name here that no decorator\n * implements is still documented: the editor can explain `@load` long before\n * `@venn-lang/load` contributes it.\n */\nconst DOCS: Record<string, string> = {\n doc: \"Documentation shown in the editor and the node tooltip.\",\n timeout: \"Abort the flow or step after a duration, e.g. `@timeout(90s)`.\",\n retry: \"Re-run on failure with backoff, e.g. `@retry(2, { backoff: 500ms })`.\",\n skip: \"Skip this flow or step, optionally conditionally.\",\n only: \"Focus: run only the annotated flows.\",\n serial: \"Forbid concurrent execution with sibling flows.\",\n lock: 'Named mutex held across workers, e.g. `@lock(\"orders\")`.',\n scope: \"Resource lifetime: `suite`, `worker`, `flow` or `step`.\",\n flaky: \"Declared flakiness tolerance, e.g. `@flaky(ratio: 0.05)`.\",\n tags: \"Tags matched by the runner's `--tags` filter.\",\n load: \"Run the flow as a load test (from `@venn-lang/load`).\",\n};\n\n/** The prose for a decorator the language documents, if it documents one. */\nexport function decoratorDoc(name: string): string | undefined {\n return DOCS[name];\n}\n","/** Where dropping the suffix would be wrong, because the user's word differs. */\nconst KINDS: Record<string, string> = {\n LetStmt: \"Binding\",\n CaptureStmt: \"Binding\",\n};\n\n/**\n * The user's word for a node type.\n *\n * `targets: [\"FlowDecl\"]` is the compiler talking to itself. A decorator says\n * it decorates a `Flow`, and that is the only spelling the editor shows.\n */\nexport function kindOf(type: string): string {\n return KINDS[type] ?? type.replace(/(Decl|Stmt|Expr)$/, \"\");\n}\n","import type { DecoratorDefinition } from \"@venn-lang/core\";\nimport { builtinDecorators } from \"@venn-lang/runtime\";\nimport { decoratorDoc } from \"./builtin-docs.js\";\nimport type { DecoInfo } from \"./deco.types.js\";\nimport { kindOf } from \"./kind-of.js\";\n\n/**\n * `@doc` is written like a decorator and read like one, but expansion never\n * sees it: it is where a declaration's documentation lives when no `##` block\n * does, and the editor is what reads it.\n */\nconst DOC: DecoInfo = {\n name: \"doc\",\n decorates: [],\n signature: \"@doc(text)\",\n doc: decoratorDoc(\"doc\"),\n};\n\n/**\n * The decorators every file has without asking: the ones the runtime ships.\n * They are read through the same shape a declared `deco` produces, so the\n * editor holds one notion of what a decorator is rather than two.\n */\nexport function builtinDecos(): DecoInfo[] {\n return [...builtinDecorators.map(fromDefinition), DOC];\n}\n\nfunction fromDefinition(decorator: DecoratorDefinition): DecoInfo {\n return {\n name: decorator.name,\n decorates: (decorator.targets ?? []).map(kindOf),\n signature: `@${decorator.name}`,\n doc: decoratorDoc(decorator.name) ?? decorator.doc,\n };\n}\n","import type { DocBlock } from \"./doc.types.js\";\n\nconst TAG = /^@(param|returns?|example|deprecated)\\b[ \\t]*(.*)$/;\n\ninterface Section {\n tag: string;\n lines: string[];\n}\n\n/** Split doc lines into a summary plus `@param` / `@returns` / `@example` / `@deprecated`. */\nexport function parseDoc(lines: readonly string[]): DocBlock {\n const doc: DocBlock = { summary: \"\", params: [], examples: [] };\n const summary: string[] = [];\n let section: Section | undefined;\n for (const line of lines) {\n const match = TAG.exec(line.trim());\n if (!match) (section ? section.lines : summary).push(line);\n else {\n apply(doc, section);\n section = { tag: match[1] as string, lines: [match[2] ?? \"\"] };\n }\n }\n apply(doc, section);\n doc.summary = summary.join(\"\\n\").trim();\n return doc;\n}\n\nfunction apply(doc: DocBlock, section: Section | undefined): void {\n if (!section) return;\n const text = section.lines.join(\"\\n\").trim();\n if (section.tag === \"param\") doc.params.push(splitParam(text));\n else if (section.tag === \"example\") doc.examples.push(text);\n else if (section.tag === \"deprecated\") doc.deprecated = text || \"This is deprecated.\";\n else doc.returns = text;\n}\n\n// `@param user The account to log in with.`: the first word is the name.\nfunction splitParam(text: string): { name: string; text: string } {\n const space = text.search(/\\s/);\n if (space < 0) return { name: text, text: \"\" };\n return { name: text.slice(0, space), text: text.slice(space).trim() };\n}\n","import { type Annotation, type AstNode, isStringLit } from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { DocBlock } from \"./doc.types.js\";\nimport { parseDoc } from \"./parse-doc.js\";\n\nconst DOC_PREFIX = \"##\";\n\n/**\n * The documentation attached to a declaration: a `##` block directly above it,\n * or its `@doc(\"…\")` annotation (§08). `##` wins when both are present.\n *\n * @returns The parsed block, or `undefined` when the declaration has neither.\n */\nexport function readDoc(document: LangiumDocument, node: AstNode): DocBlock | undefined {\n const lines = docLinesAbove(document, node);\n if (lines.length > 0) return parseDoc(lines);\n const annotated = docAnnotation(node);\n return annotated ? parseDoc(annotated.split(\"\\n\")) : undefined;\n}\n\n// Walk back over whole lines while they keep starting with `##`.\nfunction docLinesAbove(document: LangiumDocument, node: AstNode): string[] {\n const offset = node.$cstNode?.offset;\n if (offset === undefined) return [];\n const before = document.textDocument.getText().slice(0, offset).split(\"\\n\");\n before.pop();\n const lines: string[] = [];\n for (let index = before.length - 1; index >= 0; index--) {\n const text = (before[index] ?? \"\").trim();\n if (!text.startsWith(DOC_PREFIX)) break;\n lines.unshift(strip(text));\n }\n return lines;\n}\n\nfunction strip(line: string): string {\n return line.slice(DOC_PREFIX.length).replace(/^ /, \"\");\n}\n\nfunction docAnnotation(node: AstNode): string | undefined {\n const annotations = (node as { annotations?: Annotation[] }).annotations ?? [];\n const doc = annotations.find((annotation) => annotation.name === \"doc\");\n const first = doc?.args?.args?.[0]?.value;\n return first && isStringLit(first) ? first.value : undefined;\n}\n","/** A fenced `venn` block: the signature line at the top of a hover. */\nexport function fence(source: string): string {\n return [\"```venn\", source, \"```\"].join(\"\\n\");\n}\n\n/** An inline code span. */\nexport function code(text: string): string {\n return `\\`${text}\\``;\n}\n\n/**\n * Hovers read best with three levels of separation, strongest to weakest:\n *\n * - {@link rule}: a horizontal line between the signature, the body and the\n * provenance footer. This is what VS Code's own hovers use.\n * - {@link sections}: a blank line between blocks inside the body.\n * - a plain newline: a label and the content it introduces stay glued together.\n *\n * The blank line before `---` matters: markdown would otherwise read it as a\n * setext heading and turn the preceding paragraph into an `<h2>`.\n */\nexport function rule(parts: Array<string | undefined>): string {\n return present(parts).join(\"\\n\\n---\\n\\n\");\n}\n\n/** Join the blocks that exist, separated by blank lines. */\nexport function sections(parts: Array<string | undefined>): string {\n return present(parts).join(\"\\n\\n\");\n}\n\n/** Glue a label to the content it introduces, with no gap between them. */\nexport function labelled(label: string, content: string): string {\n return `${label}\\n${content}`;\n}\n\nfunction present(parts: Array<string | undefined>): string[] {\n return parts.filter((part): part is string => Boolean(part));\n}\n","import { code, fence, labelled, rule, sections } from \"../markdown/index.js\";\nimport type { DocBlock, DocParam } from \"./doc.types.js\";\n\n/**\n * Render a doc block. The prose keeps its own paragraph rhythm; the tagged\n * sections sit below a rule so they read as a distinct band, not as more prose.\n *\n * @returns Markdown, or `undefined` when the block has nothing worth showing.\n */\nexport function renderDoc(doc: DocBlock | undefined): string | undefined {\n if (!doc) return undefined;\n const prose = sections([deprecatedLine(doc.deprecated), doc.summary || undefined]);\n const tags = sections([\n paramsSection(doc.params),\n returnsLine(doc.returns),\n examplesSection(doc.examples),\n ]);\n return rule([prose || undefined, tags || undefined]) || undefined;\n}\n\nfunction deprecatedLine(deprecated: string | undefined): string | undefined {\n return deprecated && `⚠️ **Deprecated** — ${deprecated}`;\n}\n\nfunction paramsSection(params: readonly DocParam[]): string | undefined {\n if (params.length === 0) return undefined;\n const items = params.map((param) => `- ${code(param.name)}${suffix(param.text)}`);\n return labelled(\"**Parameters**\", items.join(\"\\n\"));\n}\n\nfunction suffix(text: string): string {\n return text ? ` — ${text}` : \"\";\n}\n\nfunction returnsLine(returns: string | undefined): string | undefined {\n return returns && `**Returns** — ${returns}`;\n}\n\nfunction examplesSection(examples: readonly string[]): string | undefined {\n if (examples.length === 0) return undefined;\n return labelled(\"**Example**\", examples.map((example) => fence(example)).join(\"\\n\"));\n}\n","import {\n type DecoDecl,\n type Document,\n isDecoDecl,\n isNamedType,\n type Param,\n type SingleType,\n type TypeRef,\n} from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport { readDoc, renderDoc } from \"../docs/index.js\";\nimport type { DecoInfo } from \"./deco.types.js\";\n\n/**\n * Read a `deco` the way whoever writes `@name` sees it.\n *\n * The first parameter is the target, so the type written on it is what the\n * decorator decorates. Nothing else in the declaration says so, and nothing\n * outside it can disagree.\n */\nexport function declaredDeco(args: { decl: DecoDecl; document: LangiumDocument }): DecoInfo {\n const { decl, document } = args;\n return {\n name: decl.name,\n decorates: typeNames(decl.params?.params[0]?.paramType),\n signature: signatureOf(decl),\n doc: renderDoc(readDoc(document, decl)),\n decl,\n document,\n };\n}\n\n/** Every `deco` a document declares, in the order it declares them. */\nexport function localDecos(root: Document, document: LangiumDocument): DecoInfo[] {\n return root.decls.filter(isDecoDecl).map((decl) => declaredDeco({ decl, document }));\n}\n\nfunction signatureOf(decl: DecoDecl): string {\n const params = (decl.params?.params ?? []).map(paramText).join(\", \");\n return `${decl.export ? \"pub \" : \"\"}deco ${decl.name}(${params})`;\n}\n\nfunction paramText(param: Param): string {\n const type = typeNames(param.paramType).join(\" | \");\n return type ? `${param.name}: ${type}` : param.name;\n}\n\n/** Each alternative of a written type: `Fn | Flow` is two kinds, not one. */\nfunction typeNames(ref: TypeRef | undefined): string[] {\n return (ref?.members ?? []).map(memberName).filter((name) => name.length > 0);\n}\n\n// The source's own text, so a generic like `list<number>` survives the trip.\nfunction memberName(member: SingleType): string {\n return member.$cstNode?.text ?? (isNamedType(member) ? member.name : \"\");\n}\n","import { type Document, isValueImport, type ValueImport } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments } from \"langium\";\nimport type { ImportResolver } from \"../workspace/index.js\";\nimport { builtinDecos } from \"./builtin-decos.js\";\nimport { localDecos } from \"./declared-deco.js\";\nimport type { DecoInfo } from \"./deco.types.js\";\n\n/** What a file needs consulted before it can say what `@name` means. */\nexport interface DecoScope {\n document: LangiumDocument;\n documents: LangiumDocuments;\n imports: ImportResolver;\n}\n\n/**\n * Every decorator a `@name` written in this file could mean: the ones the\n * language ships with, the `pub deco`s it imported, and the `deco`s it declares\n * itself.\n *\n * Later wins, on the same rule the runtime already follows for plugins: the\n * built-ins are a stdlib, not a reserved word list, so a file that declares its\n * own `deco retry` means its own.\n */\nexport async function decosInScope(scope: DecoScope): Promise<DecoInfo[]> {\n const root = rootOf(scope.document);\n if (!root) return builtinDecos();\n const imported = await importedDecos(root, scope);\n return dedupe([...builtinDecos(), ...imported, ...localDecos(root, scope.document)]);\n}\n\n/** The decorator a `@name` resolves to, or nothing when no decorator carries it. */\nexport async function decoNamed(name: string, scope: DecoScope): Promise<DecoInfo | undefined> {\n return (await decosInScope(scope)).find((info) => info.name === name);\n}\n\nasync function importedDecos(root: Document, scope: DecoScope): Promise<DecoInfo[]> {\n const found: DecoInfo[] = [];\n for (const decl of root.imports) {\n if (isValueImport(decl)) found.push(...(await fromModule(decl, scope)));\n }\n return found;\n}\n\n// Only what the other file marked `pub`, and only the names this one asked for.\nasync function fromModule(decl: ValueImport, scope: DecoScope): Promise<DecoInfo[]> {\n const uri = scope.imports.resolve(decl.path, scope.document.uri);\n const document = await scope.documents.getOrCreateDocument(uri).catch(() => undefined);\n const root = document && rootOf(document);\n if (!document || !root) return [];\n return localDecos(root, document).filter(\n (info) => info.decl?.export && decl.names.includes(info.name),\n );\n}\n\nfunction dedupe(all: readonly DecoInfo[]): DecoInfo[] {\n const byName = new Map<string, DecoInfo>();\n for (const info of all) byName.set(info.name, info);\n return [...byName.values()];\n}\n\nfunction rootOf(document: LangiumDocument): Document | undefined {\n return document.parseResult?.value as Document | undefined;\n}\n","import { type Document, type ImportedDeco, isDecoDecl, isValueImport } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments, URI } from \"langium\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\n/** What is needed to read a neighbour without waiting for it to load. */\nexport interface ImportedDecoScope {\n root: Document;\n uri: URI;\n documents: LangiumDocuments;\n imports: ImportResolver;\n}\n\n/**\n * The `pub deco`s this file imports, read straight out of the workspace index.\n *\n * Synchronous on purpose: the checker runs on every keystroke and cannot await\n * a file load. A neighbour the workspace has not indexed yet contributes\n * nothing this pass and is picked up by the next build, which is a moment of\n * silence rather than a wrong answer.\n */\nexport function importedDecos(scope: ImportedDecoScope): Map<string, ImportedDeco> {\n const found = new Map<string, ImportedDeco>();\n for (const decl of scope.root.imports) {\n if (isValueImport(decl)) collect({ scope, spec: decl.path, names: decl.names, found });\n }\n return found;\n}\n\nfunction collect(args: {\n scope: ImportedDecoScope;\n spec: string;\n names: readonly string[];\n found: Map<string, ImportedDeco>;\n}): void {\n const uri = args.scope.imports.resolve(args.spec, args.scope.uri);\n const document = args.scope.documents.getDocument(uri);\n const root = document && rootOf(document);\n if (!root) return;\n // Only what the other file marked `pub`, and only the names this one asked for.\n for (const decl of root.decls) {\n if (isDecoDecl(decl) && decl.export && args.names.includes(decl.name)) {\n args.found.set(decl.name, { decl, uri: uri.toString() });\n }\n }\n}\n\nfunction rootOf(document: LangiumDocument): Document | undefined {\n return document.parseResult?.value as Document | undefined;\n}\n","import { UriUtils } from \"langium\";\nimport { code, fence, rule, sections } from \"../markdown/index.js\";\nimport { decoratorDoc } from \"./builtin-docs.js\";\nimport type { DecoInfo } from \"./deco.types.js\";\n\n/**\n * Hover for a decorator: the same text whether the cursor sits on `@memoize`\n * or on the `deco memoize` that defines it. They are one thing seen twice, so\n * they read the same.\n */\nexport function decoHover(info: DecoInfo): string {\n return rule([fence(info.signature), sections([decorates(info), info.doc]), origin(info)]);\n}\n\n/**\n * A decorator the language documents but no source declares, such as `@load`\n * until `@venn-lang/load` contributes it. Explaining it beats saying nothing.\n */\nexport function documentedHover(name: string): string | undefined {\n const doc = decoratorDoc(name);\n return doc && rule([fence(`@${name}`), doc]);\n}\n\n/** What it decorates, in one phrase: the detail beside a completion item. */\nexport function decoratesLabel(decorates: readonly string[]): string {\n const named = namedKinds(decorates);\n return named.length > 0 ? named.join(\", \") : \"anything\";\n}\n\nfunction decorates(info: DecoInfo): string {\n const named = namedKinds(info.decorates);\n if (named.length === 0) return \"Decorates **anything**.\";\n return `Decorates ${named.map(code).join(\", \")}.`;\n}\n\n// `Node` is how a target says \"anything\", so it names nothing in particular.\nfunction namedKinds(decorates: readonly string[]): string[] {\n return decorates.filter((kind) => kind !== \"Node\");\n}\n\nfunction origin(info: DecoInfo): string {\n if (!info.document) return \"Built into the language.\";\n return `Declared in ${code(UriUtils.basename(info.document.uri))}`;\n}\n","import { type AstNode, type Document, isDecoDecl, isFnDecl, isFragmentDecl } from \"@venn-lang/core\";\n\n/** A name a module publishes, and which kind of thing it is. */\nexport interface ExportedName {\n name: string;\n /** `fragment`, `fn` or `deco`: what the editor draws it as. */\n origin: string;\n}\n\n/**\n * The names a module marks `pub`: everything another file is allowed to import.\n * A `deco` crosses files like a fragment or a function does.\n *\n * The kind travels with the name because the two are read together everywhere:\n * an `import { … }` list draws a fragment apart from a function, and `run`\n * accepts only one of them.\n */\nexport function exportedNames(document: Document): ExportedName[] {\n const found: ExportedName[] = [];\n for (const decl of document.decls) {\n if (!isFragmentDecl(decl) && !isFnDecl(decl) && !isDecoDecl(decl)) continue;\n if (decl.export) found.push({ name: decl.name, origin: originOf(decl) });\n }\n return found;\n}\n\nfunction originOf(decl: AstNode): string {\n if (isFragmentDecl(decl)) return \"fragment\";\n return isFnDecl(decl) ? \"fn\" : \"deco\";\n}\n","import {\n type AstNode,\n type Block,\n type Document,\n type FragmentDecl,\n isBlock,\n isCaptureStmt,\n isDatasetDecl,\n isDecoDecl,\n isDocument,\n isFnBody,\n isFnDecl,\n isFnExpr,\n isForEachStmt,\n isFragmentDecl,\n isLetStmt,\n isRepeatStmt,\n type ParamList,\n} from \"@venn-lang/core\";\n\n/** The node that binds `name`, searched from `from` outwards to the document. */\nexport function findBinding(from: AstNode, name: string): AstNode | undefined {\n let node: AstNode | undefined = from;\n while (node) {\n const found = bindingIn(node, name);\n if (found) return found;\n node = node.$container;\n }\n return undefined;\n}\n\n/** The fragment a document declares under `name`. */\nexport function findFragment(document: Document, name: string): FragmentDecl | undefined {\n return document.decls.find(\n (decl): decl is FragmentDecl => isFragmentDecl(decl) && decl.name === name,\n );\n}\n\n/**\n * The top-level declaration a document makes under `name`.\n *\n * The same lookup a name written in that file resolves to, reused from outside\n * it, which is what following an `import` does.\n */\nexport function findDeclaration(document: Document, name: string): AstNode | undefined {\n return documentBinding(document, name);\n}\n\nfunction bindingIn(node: AstNode, name: string): AstNode | undefined {\n if (isForEachStmt(node)) return node.item === name ? node : undefined;\n if (isRepeatStmt(node)) return node.index === name ? node : undefined;\n // A `deco` binds its parameters the way a `fn` does. The first one being the\n // target is a fact about its type, not about how it comes into scope.\n if (isFragmentDecl(node) || isFnDecl(node) || isFnExpr(node) || isDecoDecl(node))\n return paramNamed(node.params, name);\n if (isFnBody(node)) return node.locals.find((local) => local.name === name);\n if (isBlock(node)) return statementBinding(node, name);\n if (isDocument(node)) return documentBinding(node, name);\n return undefined;\n}\n\nfunction statementBinding(block: Block, name: string): AstNode | undefined {\n return block.stmts.find((stmt) => (isLetStmt(stmt) || isCaptureStmt(stmt)) && stmt.name === name);\n}\n\nfunction documentBinding(document: Document, name: string): AstNode | undefined {\n return document.decls.find((decl) => declares(decl, name));\n}\n\n/**\n * A `fn` is a value like any other: it can be passed, bound and called, so a\n * file that declares one has bound that name.\n */\nfunction declares(decl: AstNode, name: string): boolean {\n if (isLetStmt(decl) || isDatasetDecl(decl)) return decl.name === name;\n if (isFnDecl(decl) || isDecoDecl(decl)) return decl.name === name;\n return isFragmentDecl(decl) && decl.name === name;\n}\n\nfunction paramNamed(params: ParamList | undefined, name: string): AstNode | undefined {\n return (params?.params ?? []).find((param) => param.name === name);\n}\n","import { type AstNode, type Expr, isMember, isRef } from \"@venn-lang/core\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { findBinding } from \"./find-binding.js\";\n\n/** The dotted path an expression spells, or undefined when it is not a plain one. */\nexport function pathOf(expr: Expr | AstNode | undefined): string | undefined {\n if (!expr) return undefined;\n if (isRef(expr)) return expr.name;\n if (!isMember(expr) || expr.optional) return undefined;\n const receiver = pathOf(expr.receiver);\n return receiver === undefined ? undefined : `${receiver}.${expr.member}`;\n}\n\n/**\n * The action a path names, if the catalog knows it. `let auth = http.post …`\n * spells a call as a member chain; only the catalog can tell that apart from\n * `res.status`, and both the colours and the hover need the same answer.\n */\nexport function stdlibAction(\n node: AstNode | undefined,\n catalog: SymbolCatalog,\n): string | undefined {\n const path = pathOf(outermost(node));\n const dot = path?.indexOf(\".\") ?? -1;\n if (!path || dot < 0 || !node) return undefined;\n // A name in scope always wins, so a variable called `auth` stays a variable\n // however many stdlib namespaces happen to share its name.\n if (findBinding(node, path.slice(0, dot))) return undefined;\n return catalog.action(path.slice(0, dot), path.slice(dot + 1)) ? path : undefined;\n}\n\n/** Climb to the end of the member chain: from `http` in `http.post`, to `http.post`. */\nfunction outermost(node: AstNode | undefined): AstNode | undefined {\n let current = node;\n while (\n current?.$container &&\n isMember(current.$container) &&\n current.$container.receiver === current\n ) {\n current = current.$container;\n }\n return current;\n}\n","import {\n type AstNode,\n type InterpolationSlot,\n isStringLit,\n scanInterpolations,\n} from \"@venn-lang/core\";\nimport { CstUtils, type LangiumDocument } from \"langium\";\n\n/** A dotted path of identifiers, e.g. `env.KEYCLOAK_URL`. */\nconst PATH = /[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*/g;\n\n/** What the cursor is pointing at inside a `${…}` placeholder. */\nexport interface InterpolationHit {\n /** The string literal holding the placeholder: the anchor for scope lookup. */\n host: AstNode;\n /** The whole dotted path under the cursor. */\n path: string;\n /** Just the segment under the cursor. */\n name: string;\n /** True on the first segment, the only one a scope can bind. */\n isHead: boolean;\n /** Which dotted segment the cursor is on: 0 is the head. */\n segment: number;\n /** Absolute offset and length of {@link name}, for ranges the editor needs. */\n offset: number;\n length: number;\n /** Which `${…}` of the string this is: the index inference recorded it under. */\n slot: number;\n /** Where the cursor sits inside that placeholder's source. */\n inner: number;\n}\n\n/**\n * Resolve an offset that falls inside an interpolated string. Without this the\n * editor treats `\"${base}/users\"` as prose: no hover, no jump, no rename.\n */\nexport function interpolationAt(args: {\n document: LangiumDocument;\n offset: number;\n}): InterpolationHit | undefined {\n const found = slotAt(args);\n if (!found) return undefined;\n const { host, slot, index, inner } = found;\n const hit = hitIn({ host, slot, at: inner, base: found.base });\n return hit && { ...hit, slot: index, inner };\n}\n\n/** Which `${…}` the offset falls in, whether or not a name sits under it. */\nexport interface SlotHit {\n host: AstNode;\n slot: InterpolationSlot;\n /** The placeholder's position among the string's, as inference recorded it. */\n index: number;\n /** Where the cursor sits inside the placeholder's source. */\n inner: number;\n /** Absolute offset of the placeholder's source, for ranges the editor needs. */\n base: number;\n}\n\n/**\n * Locate the placeholder alone. Completion asks this after a dot, where there\n * is no name yet and {@link interpolationAt} would find nothing to describe.\n */\nexport function slotAt(args: { document: LangiumDocument; offset: number }): SlotHit | undefined {\n const host = stringAt(args);\n const cst = host?.$cstNode;\n if (!host || !cst) return undefined;\n const local = args.offset - cst.offset;\n const slots = scanInterpolations(cst.text);\n const index = slots.findIndex((each) => inside(each, local));\n const slot = slots[index];\n if (!slot) return undefined;\n return {\n host,\n slot,\n index,\n inner: local - slot.sourceStart,\n base: cst.offset + slot.sourceStart,\n };\n}\n\n/** A hit before the placeholder it came from is known. */\ntype Located = Omit<InterpolationHit, \"slot\" | \"inner\">;\n\nfunction inside(slot: InterpolationSlot, offset: number): boolean {\n return offset > slot.start && offset < slot.end;\n}\n\nfunction stringAt(args: { document: LangiumDocument; offset: number }): AstNode | undefined {\n const root = args.document.parseResult?.value?.$cstNode;\n const leaf = root && CstUtils.findLeafNodeAtOffset(root, args.offset);\n const node = leaf?.astNode;\n return node && isStringLit(node) ? node : undefined;\n}\n\nfunction hitIn(args: {\n host: AstNode;\n slot: InterpolationSlot;\n at: number;\n base: number;\n}): Located | undefined {\n for (const match of args.slot.source.matchAll(PATH)) {\n const start = match.index;\n if (args.at < start || args.at > start + match[0].length) continue;\n return segmentAt({\n host: args.host,\n path: match[0],\n base: args.base + start,\n at: args.at - start,\n });\n }\n return undefined;\n}\n\n/** Which dotted segment the cursor landed on, and where it sits in the document. */\nfunction segmentAt(args: { host: AstNode; path: string; base: number; at: number }): Located {\n const parts = args.path.split(\".\");\n let cursor = 0;\n let index = 0;\n while (index < parts.length - 1 && args.at > cursor + (parts[index]?.length ?? 0)) {\n cursor += (parts[index]?.length ?? 0) + 1;\n index += 1;\n }\n const name = parts[index] ?? args.path;\n return {\n host: args.host,\n path: args.path,\n name,\n isHead: index === 0,\n segment: index,\n offset: args.base + cursor,\n length: name.length,\n };\n}\n","import { type AstNode, EXPRESSION_OFFSET } from \"@venn-lang/core\";\nimport { type CstNode, CstUtils, type LangiumDocument, type LeafCstNode } from \"langium\";\nimport { slotAt } from \"./interpolation-at.js\";\n\n/** The slots a document's inference recorded, keyed by string literal. */\nexport interface SlotSource {\n slots: ReadonlyMap<AstNode, readonly (AstNode | undefined)[]>;\n}\n\n/**\n * The node a name at this offset should be resolved against.\n *\n * Usually that is simply the node under the cursor. Inside `\"${…}\"` it is not:\n * the document's tree stops at the string, so a lambda parameter written in\n * there exists only in the expression inference parsed. This reaches that one,\n * which is what makes `p` in `\"${xs.map(fn (p) => p.name)}\"` resolve at all.\n */\nexport function hostAt(args: HostArgs): AstNode | undefined {\n return inInterpolation(args) ?? nodeAt(args);\n}\n\nexport interface HostArgs {\n document: LangiumDocument;\n offset: number;\n types: SlotSource;\n /**\n * Which token answers. Hover asks about the one under the cursor; completion\n * about the one that *ends* at it, since `p.` is typed before it is asked.\n */\n prefer?: \"at\" | \"before\";\n}\n\nfunction inInterpolation(args: HostArgs): AstNode | undefined {\n const hit = slotAt(args);\n if (!hit) return undefined;\n const root = args.types.slots.get(hit.host)?.[hit.index];\n const cst = root?.$cstNode;\n return cst && leafNear(cst, hit.inner + EXPRESSION_OFFSET, args.prefer)?.astNode;\n}\n\nfunction nodeAt(args: HostArgs): AstNode | undefined {\n const root = args.document.parseResult?.value?.$cstNode;\n return root ? leafNear(root, args.offset, args.prefer)?.astNode : undefined;\n}\n\n/**\n * Mid-typing, the cursor often sits past the last token the parser kept (`p.`\n * at the end of a line), so fall back to the token just before it.\n */\nfunction leafNear(\n root: CstNode,\n offset: number,\n prefer?: \"at\" | \"before\",\n): LeafCstNode | undefined {\n // Langium's \"before\" still returns a token that *starts* at the offset, so\n // asking for the one that ends at the cursor means asking one back.\n const where = prefer === \"before\" ? offset - 1 : offset;\n return (\n CstUtils.findLeafNodeAtOffset(root, where) ?? CstUtils.findLeafNodeBeforeOffset(root, where)\n );\n}\n","import { type Document, isFragmentDecl, isValueImport } from \"@venn-lang/core\";\nimport { type LangiumDocument, type LangiumDocuments, URI } from \"langium\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\nexport interface ModuleGraphScope {\n root: Document;\n uri: URI;\n documents: LangiumDocuments;\n imports: ImportResolver;\n}\n\n/** The files an import graph reaches, and how one names another. */\nexport interface ModuleGraph {\n modules: ReadonlyMap<string, Document>;\n resolve: (from: string, spec: string) => string;\n}\n\n/**\n * Every module this file reaches, read straight out of the workspace index.\n *\n * Synchronous on purpose, for the same reason the decorators are: the checker\n * runs on every keystroke and cannot await a file load. A neighbour the\n * workspace has not indexed yet contributes nothing this pass and is picked up\n * on the next, which is a moment of silence rather than a wrong answer.\n *\n * Walked transitively, because a `pub fn` that calls another file has the\n * signature it really has only once that file has been read too.\n */\nexport function importedModules(scope: ModuleGraphScope): ModuleGraph {\n const modules = new Map<string, Document>();\n const resolve = (from: string, spec: string): string =>\n scope.imports.resolve(spec, URI.parse(from)).toString();\n walk({ document: scope.root, uri: scope.uri.toString(), modules, resolve, scope });\n return { modules, resolve };\n}\n\ninterface WalkArgs {\n document: Document;\n uri: string;\n modules: Map<string, Document>;\n resolve: (from: string, spec: string) => string;\n scope: ModuleGraphScope;\n}\n\nfunction walk(args: WalkArgs): void {\n for (const decl of args.document.imports) {\n if (!isValueImport(decl)) continue;\n const target = args.resolve(args.uri, decl.path);\n if (args.modules.has(target)) continue;\n const root = rootAt(target, args.scope);\n if (!root) continue;\n args.modules.set(target, root);\n walk({ ...args, document: root, uri: target });\n }\n}\n\nfunction rootAt(uri: string, scope: ModuleGraphScope): Document | undefined {\n const document = scope.documents.getDocument(URI.parse(uri));\n return document && rootOf(document);\n}\n\nfunction rootOf(document: LangiumDocument): Document | undefined {\n return document.parseResult?.value as Document | undefined;\n}\n\n/**\n * Which of the names a file imports are fragments.\n *\n * The answer comes from what the neighbouring files declare, never from the\n * import list alone: `run` accepts only a fragment, and a `pub fn` is not one.\n */\nexport function importedFragments(args: {\n document: Document;\n uri: string;\n graph: ModuleGraph;\n}): Set<string> {\n const found = new Set<string>();\n for (const decl of args.document.imports) {\n if (!isValueImport(decl)) continue;\n const module = args.graph.modules.get(args.graph.resolve(args.uri, decl.path));\n if (!module) continue;\n for (const name of decl.names) {\n if (declaresFragment(module, name)) found.add(name);\n }\n }\n return found;\n}\n\nfunction declaresFragment(module: Document, name: string): boolean {\n return module.decls.some((decl) => isFragmentDecl(decl) && decl.export && decl.name === name);\n}\n","import { type Document, isValueImport, type ValueImport } from \"@venn-lang/core\";\n\n/** The names a document pulls in via `import { a, b } from \"…\"`. */\nexport function importedNames(document: Document): string[] {\n const names: string[] = [];\n for (const decl of document.imports) {\n if (isValueImport(decl)) names.push(...namesOf(decl));\n }\n return names;\n}\n\nfunction namesOf(decl: ValueImport): string[] {\n if (decl.names.length > 0) return decl.names;\n return decl.default ? [decl.default] : [];\n}\n","import {\n type AstNode,\n type Block,\n type Document,\n isBlock,\n isCaptureStmt,\n isDatasetDecl,\n isDecoDecl,\n isDocument,\n isFnBody,\n isFnDecl,\n isFnExpr,\n isForEachStmt,\n isFragmentDecl,\n isLetStmt,\n isRepeatStmt,\n isValueImport,\n type ParamList,\n} from \"@venn-lang/core\";\n\n/** A name the program has bound, and the node that bound it. */\nexport interface ScopedName {\n name: string;\n node: AstNode;\n /** How it came to be here: `const`, `parameter`, `fragment`, `resource`. */\n origin: string;\n}\n\n/**\n * Every name visible from `from`, innermost first.\n *\n * The mirror of `findBinding`, which answers about one name at a time. Asking\n * the other way round is what lets the editor offer what is actually there:\n * `http.on ` suggests the server two lines up, not every namespace loaded.\n */\nexport function namesInScope(from: AstNode, at?: number): ScopedName[] {\n const found: ScopedName[] = [];\n const seen = new Set<string>();\n let node: AstNode | undefined = from;\n while (node) {\n for (const each of bindingsIn(node)) {\n if (seen.has(each.name) || beingWritten(each, at)) continue;\n seen.add(each.name);\n found.push(each);\n }\n node = node.$container;\n }\n return found;\n}\n\n/**\n * Whether the cursor is inside what this binding is being given.\n *\n * `const t = saudacao(▮)` must not offer `t`: nothing holds it yet, and\n * accepting it would write a definition in terms of itself.\n */\nfunction beingWritten(scoped: ScopedName, at: number | undefined): boolean {\n if (at === undefined) return false;\n const value = (isLetStmt(scoped.node) || isDatasetDecl(scoped.node)) && scoped.node.value;\n const cst = value ? value.$cstNode : undefined;\n return Boolean(cst && at >= cst.offset && at <= cst.end);\n}\n\nfunction bindingsIn(node: AstNode): ScopedName[] {\n if (isForEachStmt(node)) return [{ name: node.item, node, origin: \"each\" }];\n if (isRepeatStmt(node)) return node.index ? [{ name: node.index, node, origin: \"index\" }] : [];\n if (isFragmentDecl(node) || isFnDecl(node) || isFnExpr(node) || isDecoDecl(node))\n return params(node.params);\n if (isFnBody(node)) return node.locals.map((local) => named(local, local.name, \"let\"));\n if (isBlock(node)) return blockNames(node);\n if (isDocument(node)) return documentNames(node);\n return [];\n}\n\nfunction blockNames(block: Block): ScopedName[] {\n return block.stmts\n .filter((stmt) => isLetStmt(stmt) || isCaptureStmt(stmt))\n .map((stmt) => named(stmt, (stmt as { name: string }).name, kindOf(stmt)));\n}\n\nfunction documentNames(document: Document): ScopedName[] {\n const declared = document.decls.filter(declares).map((decl) => {\n const name = (decl as unknown as { name: string }).name;\n return named(decl, name, kindOf(decl));\n });\n return [...declared, ...importedInto(document)];\n}\n\n/**\n * The names this file pulled in from another.\n *\n * An imported name is bound as firmly as a local one: it can be called, passed\n * and held, so it belongs in scope like any other.\n */\nfunction importedInto(document: Document): ScopedName[] {\n const found: ScopedName[] = [];\n for (const decl of document.imports) {\n if (!isValueImport(decl)) continue;\n const names = decl.wildcard ? [decl.wildcard] : decl.names;\n for (const name of names) found.push(named(decl, name, \"import\"));\n }\n return found;\n}\n\n/**\n * A `fn` counts: it is a value the file bound, and passing one by name is how\n * `http.on(api, route)` is written.\n */\nfunction declares(decl: AstNode): boolean {\n return isLetStmt(decl) || isDatasetDecl(decl) || isFragmentDecl(decl) || isFnDecl(decl);\n}\n\nfunction kindOf(node: AstNode): string {\n if (isLetStmt(node)) return node.kind;\n if (isDatasetDecl(node)) return \"dataset\";\n if (isFragmentDecl(node)) return \"fragment\";\n return isFnDecl(node) ? \"fn\" : \"let\";\n}\n\nfunction params(list: ParamList | undefined): ScopedName[] {\n return (list?.params ?? []).map((param) => named(param, param.name, \"parameter\"));\n}\n\nfunction named(node: AstNode, name: string, origin: string): ScopedName {\n return { name, node, origin };\n}\n","import { type Document, type FragmentDecl, isValueImport } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments, URI } from \"langium\";\nimport type { ImportResolver } from \"../workspace/index.js\";\nimport { findFragment } from \"./find-binding.js\";\n\n/** Where a fragment lives. `decl` is absent when the file could not be read. */\nexport interface FragmentLocation {\n uri: URI;\n decl?: FragmentDecl;\n document?: LangiumDocument;\n}\n\nexport interface ResolveFragmentArgs {\n name: string;\n document: LangiumDocument;\n documents: LangiumDocuments;\n imports: ImportResolver;\n}\n\n/** Find a fragment: declared in this file, or followed through the `import` naming it. */\nexport async function resolveFragment(\n args: ResolveFragmentArgs,\n): Promise<FragmentLocation | undefined> {\n const root = args.document.parseResult?.value as Document | undefined;\n if (!root) return undefined;\n const local = findFragment(root, args.name);\n if (local) return { uri: args.document.uri, decl: local, document: args.document };\n const decl = root.imports.find((node) => isValueImport(node) && node.names.includes(args.name));\n return isValueImport(decl) ? fromImport(decl.path, args) : undefined;\n}\n\nasync function fromImport(path: string, args: ResolveFragmentArgs): Promise<FragmentLocation> {\n const uri = args.imports.resolve(path, args.document.uri);\n const document = await args.documents.getOrCreateDocument(uri).catch(() => undefined);\n const root = document?.parseResult?.value as Document | undefined;\n const decl = root ? findFragment(root, args.name) : undefined;\n return { uri, decl, document };\n}\n","import type { AstNode, Document, ValueImport } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments, URI } from \"langium\";\nimport type { ImportResolver } from \"../workspace/index.js\";\nimport { findDeclaration } from \"./find-binding.js\";\n\n/** Where an imported name was declared. `decl` is absent when the file cannot be read. */\nexport interface ImportedLocation {\n uri: URI;\n decl?: AstNode;\n document?: LangiumDocument;\n}\n\nexport interface ResolveImportedArgs {\n name: string;\n /** The `import { … } from \"…\"` that names it. */\n decl: ValueImport;\n document: LangiumDocument;\n documents: LangiumDocuments;\n imports: ImportResolver;\n}\n\n/**\n * Follow a name in an `import` list back to whatever declares it.\n *\n * Unlike `resolveFragment`, this does not care what kind of thing it finds: an\n * import list holds `pub fn`, `pub fragment`, `pub deco` and `pub const` side\n * by side with nothing distinguishing them, so the name is all there is to go\n * on until the other file is read.\n */\nexport async function resolveImported(args: ResolveImportedArgs): Promise<ImportedLocation> {\n const uri = args.imports.resolve(args.decl.path, args.document.uri);\n const document = await args.documents.getOrCreateDocument(uri).catch(() => undefined);\n const root = document?.parseResult?.value as Document | undefined;\n return { uri, decl: root ? findDeclaration(root, args.name) : undefined, document };\n}\n","import type { EnvVar } from \"./env.types.js\";\n\n/**\n * Words that mean the value is a credential. Matched per segment, never as a\n * substring: `KEYCLOAK_URL` contains \"key\" and is just a URL.\n */\nconst SECRET_WORDS = new Set([\n \"pass\",\n \"passwd\",\n \"password\",\n \"secret\",\n \"token\",\n \"key\",\n \"apikey\",\n \"credential\",\n \"credentials\",\n \"auth\",\n]);\n\nconst REDACTED = \"‹redacted›\";\n\n/**\n * True when the name reads like a credential, so its value is never shown.\n *\n * A hover that prints a password during a screen share leaks it, so redaction\n * belongs at the producer (§16), which is here, not in whatever renders the\n * tooltip.\n */\nexport function isSecretName(name: string): boolean {\n return segmentsOf(name).some((segment) => SECRET_WORDS.has(segment));\n}\n\n/** `ADMIN_PASSWORD` and `adminPassword` both split into `admin`, `password`. */\nfunction segmentsOf(name: string): string[] {\n return name\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean);\n}\n\n/**\n * Flatten `[env.local]`, `[env.ci]`… into one declared variable per name, each\n * carrying the comment written above it. `venn.toml` is where an environment\n * variable is documented, the same way `##` documents a declaration.\n */\nexport function envVars(\n sections: Record<string, Record<string, string>>,\n docs: Record<string, string> = {},\n): EnvVar[] {\n const found = new Map<string, EnvVar>();\n for (const [environment, vars] of Object.entries(sections)) {\n for (const [name, value] of Object.entries(vars)) {\n record({ found, name, environment, value, doc: docs[name] });\n }\n }\n const declared = [...found.values()];\n return declared.length > 0 ? [selectedEnvironment(sections), ...declared] : declared;\n}\n\n/** `env.name` is not in the file: the runner sets it to whichever `--env` ran. */\nfunction selectedEnvironment(sections: Record<string, Record<string, string>>): EnvVar {\n return {\n name: \"name\",\n doc: \"The environment this run selected, from `--env`.\",\n secret: false,\n values: Object.keys(sections).map((environment) => ({ environment, value: environment })),\n };\n}\n\nfunction record(args: {\n found: Map<string, EnvVar>;\n name: string;\n environment: string;\n value: string;\n doc?: string;\n}): void {\n const secret = isSecretName(args.name);\n const entry = { environment: args.environment, value: secret ? REDACTED : args.value };\n const existing = args.found.get(args.name);\n if (existing) existing.values.push(entry);\n else args.found.set(args.name, { name: args.name, doc: args.doc, secret, values: [entry] });\n}\n\n/** Just the declared names: what the checker matches reads against. */\nexport function envNames(sections: Record<string, Record<string, string>>): string[] {\n return envVars(sections).map((variable) => variable.name);\n}\n","import { code, fence, labelled, rule, sections } from \"../markdown/index.js\";\nimport type { EnvVar } from \"./env.types.js\";\n\n/**\n * Hover for `env.NAME`: what it is for, then what it is set to per environment.\n * Secrets show that they exist without showing what they are.\n */\nexport function envHover(variable: EnvVar): string {\n return rule([\n fence(`env.${variable.name}`),\n sections([variable.doc, valuesBlock(variable), secretNote(variable)]),\n \"**Declared in** `venn.toml`\",\n ]);\n}\n\nfunction valuesBlock(variable: EnvVar): string {\n const values = variable.values\n .map((entry) => `- ${code(entry.environment)}: ${code(entry.value)}`)\n .join(\"\\n\");\n return labelled(\"Value\", values);\n}\n\nfunction secretNote(variable: EnvVar): string | undefined {\n return variable.secret ? \"Reads like a credential, so the value is never printed.\" : undefined;\n}\n","import {\n type ActionCall,\n type Expr,\n isActionCall,\n isMatcherClause,\n type MatcherClause,\n} from \"@venn-lang/core\";\nimport { AstUtils, type LangiumDocument } from \"langium\";\n\n/** Anything written as a bare word followed by bare arguments. */\ninterface Bareword {\n args?: readonly Expr[];\n readonly $cstNode?: { offset: number };\n}\n\n/**\n * The action call the cursor is writing, if it is writing one.\n *\n * Not found by walking up from the token under the cursor: the cursor is on\n * whitespace here (`http.on ` is the whole point), and in this grammar the\n * newline is a real token belonging to the document, not to the statement. So\n * the call is found by where it starts instead: the one that begins on this\n * line, before the cursor. A statement holds at most one, so there is no\n * innermost to choose between.\n */\nexport function enclosingCall(document: LangiumDocument, offset: number): ActionCall | undefined {\n const root = document.parseResult?.value;\n if (!root) return undefined;\n const from = lineStart(document.textDocument.getText(), offset);\n let found: ActionCall | undefined;\n for (const node of AstUtils.streamAst(root)) {\n const start = node.$cstNode?.offset;\n if (isActionCall(node) && start !== undefined && start >= from && start < offset) found = node;\n }\n return found;\n}\n\n/** The same for `expect subject contains ▮`; a matcher takes bare arguments too. */\nexport function enclosingMatcher(\n document: LangiumDocument,\n offset: number,\n): MatcherClause | undefined {\n const root = document.parseResult?.value;\n if (!root) return undefined;\n const from = lineStart(document.textDocument.getText(), offset);\n let found: MatcherClause | undefined;\n for (const node of AstUtils.streamAst(root)) {\n const start = node.$cstNode?.offset;\n if (isMatcherClause(node) && start !== undefined && start >= from && start < offset) {\n found = node;\n }\n }\n return found && offset > (found.$cstNode?.offset ?? 0) + found.name.length ? found : undefined;\n}\n\nfunction lineStart(text: string, offset: number): number {\n return text.lastIndexOf(\"\\n\", Math.max(0, offset - 1)) + 1;\n}\n\n/**\n * Which argument the cursor is on.\n *\n * An argument that ends before the cursor has been written; one that ends at it\n * is still being typed. So `http.on api|` is on the first argument and\n * `http.on api |` has moved to the second, which is what makes the highlight\n * move as the space is pressed rather than a keystroke late.\n */\nexport function activeArg(call: Bareword, offset: number): number {\n let written = 0;\n for (const arg of call.args ?? []) {\n const end = arg.$cstNode?.end;\n if (end === undefined || end >= offset) break;\n written += 1;\n }\n return written;\n}\n\n/** Whether the cursor sits after the verb rather than still inside its name. */\nexport function pastTarget(call: ActionCall, offset: number): boolean {\n const start = call.$cstNode?.offset ?? 0;\n return offset > start + call.target.length;\n}\n","import { dottedPath, type Expr, isActionCall, isLetStmt, type LetStmt } from \"@venn-lang/core\";\nimport { type AstNode, AstUtils, type LangiumDocument } from \"langium\";\n\n/** A call written without brackets, wherever the language allows one. */\nexport interface BareCall {\n /** The verb being called: `http.get`. */\n target: string;\n /** The bare arguments after it, in order. */\n args: readonly Expr[];\n /** Where the verb's own name ends; the cursor must be past it. */\n after: number;\n /** The node it was found on, for looking names up in scope. */\n node: AstNode;\n}\n\n/**\n * The bracket-less call the cursor is writing.\n *\n * Two nodes spell one thing. `http.get \"u\"` standing alone is an action call;\n * bound with `const r = http.get \"u\"` it is a `let` whose value happens to name\n * a verb, with the arguments hanging off the statement. The same words deserve\n * the same help, so both are found here.\n */\nexport function enclosingBareCall(document: LangiumDocument, offset: number): BareCall | undefined {\n const root = document.parseResult?.value;\n if (!root) return undefined;\n const from = lineStart(document.textDocument.getText(), offset);\n let found: BareCall | undefined;\n for (const node of AstUtils.streamAst(root)) {\n const start = node.$cstNode?.offset;\n if (start === undefined || start < from || start >= offset) continue;\n found = asBareCall(node) ?? found;\n }\n return found && offset > found.after ? found : undefined;\n}\n\nfunction asBareCall(node: unknown): BareCall | undefined {\n if (isActionCall(node)) {\n const start = node.$cstNode?.offset ?? 0;\n return { target: node.target, args: node.args, after: start + node.target.length, node };\n }\n return isLetStmt(node) ? letCall(node) : undefined;\n}\n\n/** `const r = http.get \"u\" { … }`: the verb is the value, the args follow it. */\nfunction letCall(node: LetStmt): BareCall | undefined {\n const target = dottedPath(node.value);\n const end = node.value.$cstNode?.end;\n if (!target || end === undefined) return undefined;\n return { target, args: node.args, after: end, node };\n}\n\nfunction lineStart(text: string, offset: number): number {\n return text.lastIndexOf(\"\\n\", Math.max(0, offset - 1)) + 1;\n}\n","import { PRELUDE_SPECS } from \"@venn-lang/core\";\nimport { type ActionDefinition, type ArgSpec, paramSpecs } from \"@venn-lang/sdk\";\nimport { type FnSpec, showSpec } from \"@venn-lang/types\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport type { CallShape, ShownArg } from \"./call-shape.types.js\";\n\n/**\n * What `target` takes, as the editor describes it back.\n *\n * A verb people can call is a verb people can be told about, whether a plugin\n * contributes it or the prelude does. Returns undefined only when nothing in\n * the language answers to that name.\n */\nexport function callShape(target: string, catalog: SymbolCatalog): CallShape | undefined {\n const dot = target.indexOf(\".\");\n if (dot < 0) return preludeShape(target);\n const entry = catalog.action(target.slice(0, dot), target.slice(dot + 1));\n if (!entry) return undefined;\n return {\n target,\n args: entry.action.args ? shownArgs(entry.action.args) : unnamed(entry.action.signature),\n options: paramSpecs(entry.action.params),\n doc: entry.action.doc,\n returns: returnOf(entry.action),\n };\n}\n\n/** The same, for a bareword matcher: `expect res contains \"ok\"`. */\nexport function matcherShape(name: string, catalog: SymbolCatalog): CallShape | undefined {\n const entry = catalog.matcher(name);\n if (!entry) return undefined;\n return {\n target: name,\n args: shownArgs(entry.matcher.args ?? []),\n options: paramSpecs(entry.matcher.params),\n doc: entry.matcher.appliesTo ? `Applies to ${entry.matcher.appliesTo}.` : undefined,\n };\n}\n\n/**\n * What the verb gives back, in the language's own words.\n *\n * Read from the declared type, never from prose beside it: a second place to\n * say the same thing is a second place to say it differently.\n */\nfunction returnOf(action: ActionDefinition): string | undefined {\n const result = action.signature?.result;\n // Nothing worth saying about a verb that answers nothing.\n if (!result || (result.kind === \"prim\" && result.name === \"void\")) return undefined;\n return showSpec(result);\n}\n\n/** Published argument specs as the editor shows them. */\nexport function shownArgs(specs: readonly ArgSpec[]): readonly ShownArg[] {\n return specs.map(shownArg);\n}\n\n/**\n * What can still be said about a verb whose author named nothing: how many\n * arguments it takes, and of what. Worse than a name and far better than\n * silence, and the only thing a plugin from outside this repo may ever offer.\n */\nfunction unnamed(signature: FnSpec | undefined): readonly ShownArg[] {\n return (signature?.params ?? []).map((type) => ({ name: \"\", type: showSpec(type) }));\n}\n\nfunction shownArg(spec: ArgSpec): ShownArg {\n return {\n name: spec.name,\n type: showSpec(spec.type),\n doc: spec.doc,\n optional: spec.optional,\n rest: spec.rest,\n };\n}\n\n/**\n * The prelude describes itself already: the checker reads its types and the\n * editor its prose. This reads the same table, so the two never disagree.\n */\nfunction preludeShape(name: string): CallShape | undefined {\n const spec = PRELUDE_SPECS[name];\n if (!spec) return undefined;\n return {\n target: name,\n args: (spec.args ?? []).map((each) => ({ ...each })),\n options: [],\n doc: spec.doc,\n };\n}\n","import {\n type AstNode,\n DYNAMIC,\n isDatasetDecl,\n isFnDecl,\n isFnExpr,\n isFragmentDecl,\n isLetStmt,\n type ParamList,\n showTypes,\n} from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { TypeService } from \"../types/index.js\";\nimport type { CallShape } from \"./call-shape.types.js\";\n\nexport interface DeclaredShapeArgs {\n /** The node that binds the name: what `findBinding` answered. */\n binding: AstNode;\n name: string;\n document: LangiumDocument;\n types: TypeService;\n}\n\n/**\n * What a function the file itself declares takes, by name.\n *\n * The names are written right there in the source; the types come from\n * inference, which for an unannotated `fn` means a variable until the body\n * pins it down. A name with `a` next to it still tells the reader which\n * argument they are on, which is the question a half-typed call asks.\n */\nexport function declaredShape(args: DeclaredShapeArgs): CallShape | undefined {\n const params = paramsOf(args.binding);\n if (!params) return undefined;\n const known = args.types.of(args.document).types;\n // Named together, so two unrelated parameters do not both come back as `a`.\n const shown = showTypes(params.params.map((param) => known.get(param) ?? DYNAMIC));\n return {\n target: args.name,\n args: params.params.map((param, at) => ({ name: param.name, type: shown[at] ?? \"dynamic\" })),\n options: [],\n returns: undefined,\n };\n}\n\n/** The parameter list, wherever the binding keeps one. */\nfunction paramsOf(binding: AstNode): ParamList | undefined {\n if (isFnDecl(binding) || isFragmentDecl(binding) || isFnExpr(binding)) return binding.params;\n // `const op = (a, b) => a + b`: the parameters belong to the lambda it holds.\n const value = (isLetStmt(binding) || isDatasetDecl(binding)) && binding.value;\n return value && isFnExpr(value) ? value.params : undefined;\n}\n","import type { AstNode } from \"@venn-lang/core\";\nimport { CstUtils, type LangiumDocument } from \"langium\";\n\n/** A bracketed call the cursor is inside, read from the text. */\nexport interface ParenCall {\n /** The dotted name being called: `saudacao`, `fmt.json`. */\n path: string;\n /** Which argument is being written, counted by the commas before it. */\n active: number;\n /** A node in the same scope, for looking the name up. */\n host: AstNode | undefined;\n}\n\n/**\n * The innermost `f(…)` whose brackets hold the cursor.\n *\n * Read from the text rather than from the tree, because the states that most\n * need explaining are exactly the ones that do not parse: `f(\"a\", ▮)` has a\n * trailing comma, which is a syntax error, and a hint that disappears the\n * moment you press comma is a hint that is never there when wanted.\n */\nexport function enclosingParenCall(\n document: LangiumDocument,\n offset: number,\n): ParenCall | undefined {\n const text = document.textDocument.getText();\n const open = innermostOpenParen(text, offset);\n if (open < 0) return undefined;\n const path = nameBefore(text.slice(0, open));\n if (!path) return undefined;\n return { path, active: commas(text.slice(open + 1, offset)), host: nodeNear(document, open) };\n}\n\n/** How far back to look for the bracket. A call this long is not being typed. */\nconst REACH = 2000;\n\n/** The `(` still open at the cursor, scanning backwards. */\nfunction innermostOpenParen(text: string, offset: number): number {\n let depth = 0;\n for (let at = offset - 1; at >= Math.max(0, offset - REACH); at -= 1) {\n const char = text[at];\n if (char === \")\") depth += 1;\n else if (char === \"(\") {\n if (depth === 0) return at;\n depth -= 1;\n }\n }\n return -1;\n}\n\nconst CALLEE = /([A-Za-z_]\\w*(?:\\.\\w+)*)$/;\n\n/** The dotted name written immediately before the bracket. */\nfunction nameBefore(before: string): string | undefined {\n return CALLEE.exec(before)?.[1];\n}\n\n/** Commas at this bracket's own level: those in a nested call are not ours. */\nfunction commas(inside: string): number {\n let depth = 0;\n let count = 0;\n for (const char of inside) {\n if (char === \"(\" || char === \"[\" || char === \"{\") depth += 1;\n else if (char === \")\" || char === \"]\" || char === \"}\") depth -= 1;\n else if (char === \",\" && depth === 0) count += 1;\n }\n return count;\n}\n\n/** Any node at the bracket, so a name can be looked up in the right scope. */\nfunction nodeNear(document: LangiumDocument, offset: number): AstNode | undefined {\n const root = document.parseResult?.value?.$cstNode;\n if (!root) return undefined;\n const leaf =\n CstUtils.findLeafNodeAtOffset(root, offset) ?? CstUtils.findLeafNodeBeforeOffset(root, offset);\n return leaf?.astNode;\n}\n","import type { ParamSpec } from \"@venn-lang/sdk\";\nimport type { ParameterInformation, SignatureInformation } from \"vscode-languageserver\";\nimport type { CallShape, ShownArg } from \"./call-shape.types.js\";\n\n/**\n * A call written out the way it is actually written: `http.on server handler`,\n * no brackets, no commas. Each argument carries the character range it occupies\n * in that line, which is what lets the editor bold the one being typed instead\n * of guessing by substring.\n */\nexport function signatureOfShape(shape: CallShape): SignatureInformation {\n return render(shape, { open: \" \", separator: \" \", close: \"\" });\n}\n\n/**\n * The same call, written the way a bracketed one is: `saudacao(nome: a, idade: b)`.\n *\n * Two renderings because the language has two call syntaxes, and a hint that\n * shows the wrong one teaches the wrong thing.\n */\nexport function bracketed(shape: CallShape): SignatureInformation {\n return render(shape, { open: \"(\", separator: \", \", close: \")\" });\n}\n\ninterface Punctuation {\n open: string;\n separator: string;\n close: string;\n}\n\n/**\n * One renderer for both syntaxes: only the punctuation between the parts\n * differs, and the options are the last part in either. They are an argument\n * like any other, so they get a range and documentation of their own rather\n * than being printed as decoration nobody can point at.\n */\nfunction render(shape: CallShape, punctuation: Punctuation): SignatureInformation {\n const texts = [...shape.args.map(label), ...optionsPart(shape)];\n const parameters: ParameterInformation[] = [];\n let at = shape.target.length + punctuation.open.length;\n texts.forEach((text, index) => {\n parameters.push({ label: [at, at + text.length], documentation: docFor(shape, index) });\n at += text.length + punctuation.separator.length;\n });\n const body = texts.join(punctuation.separator);\n return {\n label: `${shape.target}${texts.length ? punctuation.open : \"\"}${body}${texts.length ? punctuation.close : \"\"}`,\n parameters,\n documentation: summary(shape),\n };\n}\n\n/** The options, when the verb accepts any: one last argument, always a map. */\nfunction optionsPart(shape: CallShape): string[] {\n return shape.options.length > 0 ? [\"{ … }\"] : [];\n}\n\n/** An argument's own line, or, for the last part, the keys the map accepts. */\nfunction docFor(shape: CallShape, index: number): string | undefined {\n const arg = shape.args[index];\n if (arg) return arg.doc;\n return shape.options.map(optionLine).join(\"\\n\");\n}\n\nfunction optionLine(spec: ParamSpec): string {\n const required = spec.required ? \" *(required)*\" : \"\";\n const doc = spec.doc ? ` — ${spec.doc}` : \"\";\n return `- \\`${spec.name}\\`: \\`${spec.type}\\`${required}${doc}`;\n}\n\n/**\n * `server: HttpServer`, or `reason?: string` when the call works without it.\n * An argument nobody named shows as its type alone, rather than as a stray colon.\n */\nfunction label(arg: ShownArg): string {\n if (!arg.name) return arg.type;\n return `${arg.name}${mark(arg)}: ${arg.type}`;\n}\n\nfunction mark(arg: ShownArg): string {\n if (arg.rest) return \"…\";\n return arg.optional ? \"?\" : \"\";\n}\n\n/**\n * The line under the signature. It says what the verb does and what it gives\n * back: the two questions someone halfway through typing it is asking.\n */\nfunction summary(shape: CallShape): string | undefined {\n const returns = shape.returns ? `Gives back ${shape.returns}.` : undefined;\n return [shape.doc, returns].filter(Boolean).join(\" \") || undefined;\n}\n","import type { AstNode } from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { findBinding } from \"../document/index.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport { callShape } from \"./call-shape.js\";\nimport type { CallShape } from \"./call-shape.types.js\";\nimport { declaredShape } from \"./declared-shape.js\";\n\nexport interface ShapeAtArgs {\n /** The dotted name being called. */\n path: string;\n /** A node in the calling scope, for looking that name up. */\n host: AstNode | undefined;\n document: LangiumDocument;\n catalog: SymbolCatalog;\n types: TypeService;\n}\n\n/**\n * What the callee of `f(…)` takes.\n *\n * One resolver for every kind of callee, so a call reads the same whoever wrote\n * it. A name the file bound wins (a `fn`, a `fragment`, a `const` holding a\n * lambda); otherwise the prelude and the loaded plugins answer. That a local\n * name beats a namespace is the rule the evaluator follows too.\n */\nexport function shapeAt(args: ShapeAtArgs): CallShape | undefined {\n const head = args.path.split(\".\")[0];\n if (!head) return undefined;\n const binding = args.host && findBinding(args.host, head);\n if (!binding) return callShape(args.path, args.catalog);\n if (args.path !== head) return undefined;\n return declaredShape({ binding, name: head, document: args.document, types: args.types });\n}\n","import type { LangiumDocument } from \"langium\";\nimport type { SignatureHelpProvider } from \"langium/lsp\";\nimport type {\n SignatureHelp,\n SignatureHelpOptions,\n SignatureHelpParams,\n} from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport { activeArg, enclosingMatcher } from \"./action-call.js\";\nimport { enclosingBareCall } from \"./bare-call.js\";\nimport { callShape, matcherShape } from \"./call-shape.js\";\nimport type { CallShape } from \"./call-shape.types.js\";\nimport { enclosingParenCall } from \"./paren-call.js\";\nimport { bracketed, signatureOfShape } from \"./render-shape.js\";\nimport { shapeAt } from \"./shape-at.js\";\n\n/**\n * What the call being typed takes, one argument at a time.\n *\n * The space is a trigger character because Venn's calls have no brackets to\n * hang one off: `http.on ` is already a call with an argument due. Waiting for\n * a `(` that never comes is how a language ends up unable to explain itself.\n */\nexport class VennSignatureHelpProvider implements SignatureHelpProvider {\n private readonly catalog: SymbolCatalog;\n private readonly types: TypeService;\n\n constructor(services: VennServices) {\n this.catalog = services.catalog;\n this.types = services.types;\n }\n\n get signatureHelpOptions(): SignatureHelpOptions {\n return { triggerCharacters: [\"(\", \",\", \" \"], retriggerCharacters: [\" \", \",\"] };\n }\n\n provideSignatureHelp(\n document: LangiumDocument,\n params: SignatureHelpParams,\n ): SignatureHelp | undefined {\n const offset = document.textDocument.offsetAt(params.position);\n return (\n this.forParens(document, offset) ??\n this.forMatcher(document, offset) ??\n this.forAction(document, offset)\n );\n }\n\n /** `saudacao(▮)`: a call with brackets, wherever its callee was declared. */\n private forParens(document: LangiumDocument, offset: number): SignatureHelp | undefined {\n const found = enclosingParenCall(document, offset);\n if (!found) return undefined;\n const shape = shapeAt({ ...found, document, catalog: this.catalog, types: this.types });\n if (!shape || parts(shape) === 0) return undefined;\n return help(bracketed(shape), found.active, parts(shape));\n }\n\n /** `expect res contains ▮`: the value the check is waiting for. */\n private forMatcher(document: LangiumDocument, offset: number): SignatureHelp | undefined {\n const clause = enclosingMatcher(document, offset);\n if (!clause) return undefined;\n const shape = matcherShape(clause.name, this.catalog);\n if (!shape || parts(shape) === 0) return undefined;\n return help(signatureOfShape(shape), activeArg(clause, offset), parts(shape));\n }\n\n /** `http.on api handler`: a verb and its bare arguments, bound or not. */\n private forAction(document: LangiumDocument, offset: number): SignatureHelp | undefined {\n const call = enclosingBareCall(document, offset);\n if (!call) return undefined;\n const shape = callShape(call.target, this.catalog);\n if (!shape || parts(shape) === 0) return undefined;\n return help(signatureOfShape(shape), activeArg(call, offset), parts(shape));\n }\n}\n\n/**\n * How many things the signature can point at: the positional arguments, plus\n * the options map when there is one. The map is the last argument, not\n * decoration.\n */\nfunction parts(shape: CallShape): number {\n return shape.args.length + (shape.options.length > 0 ? 1 : 0);\n}\n\nfunction help(\n signature: SignatureHelp[\"signatures\"][number],\n active: number,\n count: number,\n): SignatureHelp {\n return {\n signatures: [signature],\n activeSignature: 0,\n activeParameter: Math.min(active, Math.max(count - 1, 0)),\n };\n}\n","import { CompletionItemKind } from \"vscode-languageserver\";\n\n/**\n * One icon per kind of thing, decided in one place so the item builders cannot\n * disagree about what a published type or a bound name looks like.\n *\n * The rule the icons follow is what the reader is about to write: a `Method`\n * needs brackets, a `Property` is computed and read bare, a `Field` is data\n * sitting there. Everything else names the sort of declaration it came from.\n */\nexport interface IconTable {\n readonly constant: CompletionItemKind;\n readonly variable: CompletionItemKind;\n readonly callable: CompletionItemKind;\n readonly fragment: CompletionItemKind;\n readonly verb: CompletionItemKind;\n readonly matcher: CompletionItemKind;\n readonly decorator: CompletionItemKind;\n readonly namespace: CompletionItemKind;\n readonly type: CompletionItemKind;\n readonly builtinType: CompletionItemKind;\n readonly key: CompletionItemKind;\n readonly computed: CompletionItemKind;\n readonly method: CompletionItemKind;\n readonly env: CompletionItemKind;\n readonly path: CompletionItemKind;\n readonly keyword: CompletionItemKind;\n}\n\nexport const ICON: IconTable = {\n /** `const x = …`: bound once, never reassigned. */\n constant: CompletionItemKind.Constant,\n /** `let x = …`, a parameter, a loop variable. */\n variable: CompletionItemKind.Variable,\n /** A `fn`: called for a value, in an expression. */\n callable: CompletionItemKind.Function,\n /**\n * A `fragment`: a named piece of a flow, invoked with `run`.\n *\n * Deliberately not the icon a function carries. A function gives back a\n * value; a fragment gives back steps that the report records and that can\n * fail. The icon has to separate them while the reader is still choosing.\n */\n fragment: CompletionItemKind.Snippet,\n /** A verb a plugin contributes: `http.get`. */\n verb: CompletionItemKind.Function,\n /** A word usable after `expect`: `contains`, `oneOf`. */\n matcher: CompletionItemKind.Function,\n /** A `deco`, applied with `@`. */\n decorator: CompletionItemKind.Function,\n /** A plugin namespace, or a package to `use`. */\n namespace: CompletionItemKind.Module,\n /** A type: declared here, published by a package, or a `type` alias. */\n type: CompletionItemKind.Struct,\n /** One of the language's own types: `string`, `duration`. */\n builtinType: CompletionItemKind.Keyword,\n /** A key of a map someone writes: an option, a field of a record. */\n key: CompletionItemKind.Field,\n /** Read bare, computed each time: `xs.len`, `m.keys`. */\n computed: CompletionItemKind.Property,\n /** Called with brackets: `m.get(k)`, `xs.map(f)`. */\n method: CompletionItemKind.Method,\n /** A variable the manifest declares. */\n env: CompletionItemKind.Constant,\n /** A file path, offered inside an import string. */\n path: CompletionItemKind.File,\n /** A keyword of the language: `step`, `forEach`. */\n keyword: CompletionItemKind.Keyword,\n};\n\n/**\n * The icon for a name the program bound, from how it was bound.\n *\n * `origin` is what {@link ScopedName} recorded when the name was found, so the\n * editor draws a `const` apart from a `let` apart from a `fn` without anyone\n * having to look the declaration up a second time.\n */\nexport function iconForOrigin(origin: string): CompletionItemKind {\n if (origin === \"const\" || origin === \"dataset\") return ICON.constant;\n if (origin === \"fragment\") return ICON.fragment;\n if (origin === \"fn\" || origin === \"deco\") return ICON.callable;\n return ICON.variable;\n}\n","import { type Document, isFragmentDecl, showType, specToType } from \"@venn-lang/core\";\nimport { type ActionDefinition, paramSpecs } from \"@venn-lang/sdk\";\nimport { showSpec } from \"@venn-lang/types\";\nimport { type CompletionItem, CompletionItemKind, type Range } from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { type DecoInfo, decoratesLabel } from \"../deco/index.js\";\nimport type { ExportedName } from \"../document/index.js\";\nimport type { EnvVar } from \"../env/index.js\";\nimport { ICON, iconForOrigin } from \"./icons.js\";\n\nconst KEYWORDS = [\n \"step\",\n \"group\",\n \"if\",\n \"else\",\n \"forEach\",\n \"repeat\",\n \"while\",\n \"parallel\",\n \"race\",\n \"try\",\n \"catch\",\n \"finally\",\n \"expect\",\n \"run\",\n \"let\",\n \"const\",\n \"return\",\n \"break\",\n \"continue\",\n \"defer\",\n \"setup\",\n \"teardown\",\n \"beforeEach\",\n \"afterEach\",\n];\n// Callable without a `use`: verbs that act, plus the values with no receiver.\nconst PRELUDE = [\n \"print\",\n \"log\",\n \"wait\",\n \"skip\",\n \"fail\",\n \"exit\",\n \"range\",\n \"str\",\n \"typeOf\",\n \"pretty\",\n];\n\n/**\n * Every item carries an explicit `textEdit` over `range`. VS Code's default word\n * rules stop at `@` and `/`, so without it accepting `@venn-lang/http` inside\n * `\"@venn-lang/\"` would paste the prefix twice.\n */\nexport function item(args: {\n label: string;\n kind: CompletionItemKind;\n range: Range;\n detail?: string;\n documentation?: string;\n /** What to write, when it differs from the label: `body` inserts `body: `. */\n insert?: string;\n}): CompletionItem {\n return {\n label: args.label,\n kind: args.kind,\n detail: args.detail,\n documentation: args.documentation,\n filterText: args.label,\n textEdit: { range: args.range, newText: args.insert ?? args.label },\n };\n}\n\n/**\n * The keys of an action's options map, read from its params schema. That is the\n * schema the runtime validates against, so the editor cannot drift from it.\n */\nexport function optionItems(args: {\n target: string;\n catalog: SymbolCatalog;\n range: Range;\n}): CompletionItem[] {\n const dot = args.target.indexOf(\".\");\n if (dot < 0) return [];\n const entry = args.catalog.action(args.target.slice(0, dot), args.target.slice(dot + 1));\n return paramSpecs(entry?.action.params).map((spec) =>\n item({\n label: spec.name,\n kind: ICON.key,\n range: args.range,\n detail: spec.required ? `${spec.type} (required)` : spec.type,\n documentation: spec.doc,\n insert: `${spec.name}: `,\n }),\n );\n}\n\n/** `env.`: the variables `venn.toml` declares, secrets shown without values. */\nexport function envItems(vars: readonly EnvVar[], range: Range): CompletionItem[] {\n return vars.map((variable) =>\n item({\n label: variable.name,\n kind: ICON.env,\n range,\n detail: variable.secret ? \"secret\" : variable.values[0]?.value,\n documentation:\n variable.doc ??\n `Declared in venn.toml for ${variable.values.map((v) => v.environment).join(\", \")}.`,\n }),\n );\n}\n\nexport function packageItems(catalog: SymbolCatalog, range: Range): CompletionItem[] {\n return catalog.packages().map((label) => {\n const namespace = catalog.namespaceOfPackage(label);\n return item({ label, kind: ICON.namespace, range, detail: namespace });\n });\n}\n\n/**\n * The types a namespace publishes: `http.Request`, `http.Server`.\n *\n * They stand beside the verbs because that is where they are written. A\n * namespace answering only with verbs leaves the author guessing what those\n * verbs deal in.\n */\nexport function typeItems(\n namespace: string,\n catalog: SymbolCatalog,\n range: Range,\n): CompletionItem[] {\n return catalog.typesIn(namespace).map((entry) =>\n item({\n label: entry.name,\n kind: ICON.type,\n range,\n detail: showType(specToType(entry.spec, () => undefined)),\n documentation: `Type published by ${entry.package}.`,\n }),\n );\n}\n\nexport function actionItems(\n namespace: string,\n catalog: SymbolCatalog,\n range: Range,\n): CompletionItem[] {\n return catalog.actionsIn(namespace).map((entry) =>\n item({\n label: entry.name,\n kind: ICON.verb,\n range,\n detail: returnOf(entry.action) ?? entry.package,\n documentation: entry.action.doc,\n }),\n );\n}\n\n/** What the verb answers with, taken from its declared type, never from prose. */\nfunction returnOf(action: ActionDefinition): string | undefined {\n const result = action.signature?.result;\n if (!result || (result.kind === \"prim\" && result.name === \"void\")) return undefined;\n return `-> ${showSpec(result)}`;\n}\n\nexport function matcherItems(catalog: SymbolCatalog, range: Range): CompletionItem[] {\n return catalog\n .matchers()\n .map((entry) => item({ label: entry.name, kind: ICON.matcher, range, detail: entry.package }));\n}\n\n/**\n * After `@`: every decorator in scope, each saying what it decorates.\n *\n * What it decorates is the detail, not an afterthought: applying one to the\n * wrong kind is the mistake this list exists to prevent.\n */\nexport function annotationItems(decos: readonly DecoInfo[], range: Range): CompletionItem[] {\n return decos.map((deco) =>\n item({\n label: deco.name,\n kind: ICON.decorator,\n range,\n detail: decoratesLabel(deco.decorates),\n documentation: deco.doc,\n }),\n );\n}\n\nexport function fragmentItems(args: {\n document: Document | undefined;\n /** The imported names that really are fragments, from the files they came from. */\n imported: ReadonlySet<string>;\n range: Range;\n}): CompletionItem[] {\n if (!args.document) return [];\n const local = args.document.decls.filter(isFragmentDecl).map((decl) => decl.name);\n return simple([...local, ...args.imported], ICON.fragment, args.range);\n}\n\nexport function pathItems(paths: readonly string[], range: Range): CompletionItem[] {\n return simple(paths, CompletionItemKind.File, range);\n}\n\nexport function exportItems(names: readonly ExportedName[], range: Range): CompletionItem[] {\n return names.map((each) =>\n item({\n label: each.name,\n kind: iconForOrigin(each.origin),\n range,\n detail: `pub ${each.origin}`,\n }),\n );\n}\n\n/** At the start of a statement: namespaces, prelude verbs and structural keywords. */\nexport function openingItems(catalog: SymbolCatalog, range: Range): CompletionItem[] {\n return [\n ...simple(catalog.namespaces(), CompletionItemKind.Module, range),\n ...simple(PRELUDE, CompletionItemKind.Function, range),\n ...simple(KEYWORDS, CompletionItemKind.Keyword, range),\n ];\n}\n\nfunction simple(\n labels: readonly string[],\n kind: CompletionItemKind,\n range: Range,\n): CompletionItem[] {\n return labels.map((label) => item({ label, kind, range }));\n}\n","import { type AstNode, showType, type Type } from \"@venn-lang/core\";\nimport type { CompletionItem, Range } from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport type { ScopedName } from \"../document/index.js\";\nimport type { ShownArg } from \"../signature/index.js\";\nimport { ICON, iconForOrigin } from \"./icons.js\";\nimport { item } from \"./items.js\";\n\nexport interface ArgumentItemsArgs {\n names: readonly ScopedName[];\n types: ReadonlyMap<AstNode, Type>;\n /** The argument being written, when the verb said what it takes. */\n expects: ShownArg | undefined;\n catalog: SymbolCatalog;\n range: Range;\n}\n\n/**\n * What can go here, most likely first.\n *\n * An argument almost always wants something the program already has: the server\n * two lines up, the parameter of the enclosing function. Offering the loaded\n * namespaces first, as a fresh statement would, buries the one answer under\n * dozens that cannot be right.\n */\nexport function argumentItems(args: ArgumentItemsArgs): CompletionItem[] {\n const values = args.names.map((each) => valueItem(each, args));\n const namespaces = args.catalog.namespaces().map((name) => nsItem(name, args.range));\n return [...values, ...namespaces];\n}\n\n/**\n * The names a program holds, offered where no type is expected of them.\n *\n * The start of a statement is such a place: nothing says what should go there,\n * so nothing can be ranked as fitting, only drawn for what it is.\n */\nexport function boundItems(names: readonly ScopedName[], range: Range): CompletionItem[] {\n return names.map((scoped) => ({\n ...item({\n label: scoped.name,\n kind: iconForOrigin(scoped.origin),\n range,\n detail: scoped.origin,\n }),\n sortText: `0${scoped.name}`,\n }));\n}\n\nfunction valueItem(scoped: ScopedName, args: ArgumentItemsArgs): CompletionItem {\n const type = args.types.get(scoped.node);\n const shown = type ? showType(type) : undefined;\n return {\n ...item({\n label: scoped.name,\n kind: iconForOrigin(scoped.origin),\n range: args.range,\n detail: shown ? `${scoped.origin} ${scoped.name}: ${shown}` : scoped.origin,\n }),\n sortText: `${fits(shown, args.expects) ? \"0\" : \"1\"}${scoped.name}`,\n };\n}\n\nfunction nsItem(name: string, range: Range): CompletionItem {\n return {\n ...item({ label: name, kind: ICON.namespace, range }),\n sortText: `2${name}`,\n };\n}\n\n/**\n * Whether a value is the kind of thing this argument wants. Compared as the two\n * read, not by unification: the checker's types carry inference variables that\n * matching would have to bind, and ranking a list must not change what a\n * program means.\n */\nfunction fits(shown: string | undefined, expects: ShownArg | undefined): boolean {\n if (!shown || !expects) return false;\n if (shown === expects.type) return true;\n return expects.type.startsWith(\"fn(\") && shown.startsWith(\"fn(\");\n}\n","import type { CompletionContext, CursorText } from \"./completion.types.js\";\n\nconst PACKAGE = /\\buse\\s+\"([^\"]*)$/;\nconst MODULE_PATH = /\\bfrom\\s+\"([^\"]*)$/;\nconst IMPORT_NAME = /\\bimport\\s*\\{([^}]*)$/;\n/**\n * The whole dotted receiver, so `cfg.server.` offers what `cfg.server` holds.\n *\n * The lookbehind makes the match start at a token boundary. Without it the\n * receiver could be found inside something else: `_` opens an identifier, so\n * `1_000_000.` would take `_000_000` for its receiver and offer nothing.\n */\nconst ACTION = /(?<![\\w.])([A-Za-z_]\\w*(?:\\.\\w+)*)\\.(\\w*)$/;\nconst ANNOTATION = /@(\\w*)$/;\nconst FRAGMENT = /\\brun\\s+(\\w*)$/;\nconst MATCHER = /\\bexpect\\b\\s+\\S+\\s+(\\w*)$/;\n/**\n * Where a type goes: after the `:` of a field, a parameter or a binding, after\n * the `->` of a declared return, or after the `|` of a union.\n *\n * A name has to sit before the colon, which is what tells a type annotation\n * from a map entry: `{ port: ▮ }` holds a value, `port: ▮` in a `type` block\n * holds a type. The brace is the difference, and the caller has already\n * classified an open one.\n */\nconst TYPE_POSITION = /(?:^|[^:])(?::|->|\\|)\\s*([A-Za-z_][\\w.]*)?$/;\n/**\n * A verb, a space, and whatever is being written after it: `http.on ▮`,\n * `http.on api ▮`, `print ▮`. The leading anchor keeps this to the head of a\n * statement, so `1 + ▮` and the tail of an expression are not swept in.\n */\nconst ARGUMENT = /^\\s*([A-Za-z_]\\w*(?:\\.\\w+)*)\\s/;\nconst FROM_PATH = /\\bfrom\\s+\"([^\"]+)\"/;\n/**\n * A dot whose receiver no path can name: `1234.567.round`, `f(x).len`,\n * `xs[0].name`, `\"ab\".upper`. Tried after {@link ACTION}, so a receiver that is\n * a name goes there first and this catches the rest: a digit, a closing\n * bracket, a quote. There is nothing to look up by text, so the node under the\n * cursor answers instead.\n */\nconst MEMBER = /[\\w)\\]\"']\\.(\\w*)$/;\n\n/** The dotted path that owns the `{` we are inside of, with no brace between. */\nconst OPTION_OWNER = /([A-Za-z_]\\w*(?:\\.\\w+)+)[^{}]*$/;\n\n/**\n * Classify the cursor from the text before it. String contexts are tested first:\n * a module path like `#shared/auth.vn` also looks like `namespace.action`.\n *\n * @param text The line, the prefix up to the cursor and the document before it.\n * @returns The narrowest context that matches, or `statement` when none does.\n */\nexport function contextAt(text: CursorText): CompletionContext {\n const { prefix, line } = text;\n const inString = stringContext(prefix, line);\n if (inString) return inString;\n const action = ACTION.exec(prefix);\n if (action?.[1]) return { kind: \"action\", receiver: action[1], from: back(prefix, action[2]) };\n const member = MEMBER.exec(prefix);\n if (member) return { kind: \"member\", from: back(prefix, member[1]) };\n const annotation = ANNOTATION.exec(prefix);\n if (annotation) return { kind: \"annotation\", from: back(prefix, annotation[1]) };\n const fragment = FRAGMENT.exec(prefix);\n if (fragment) return { kind: \"fragment\", from: back(prefix, fragment[1]) };\n const matcher = MATCHER.exec(prefix);\n if (matcher) return { kind: \"matcher\", from: back(prefix, matcher[1]) };\n return (\n optionContext(text) ??\n typeContext(text) ??\n argumentContext(prefix) ?? { kind: \"statement\", from: back(prefix, trailingWord(prefix)) }\n );\n}\n\n/**\n * `id: ▮`: a type is due.\n *\n * Only outside an options map, which the caller has already ruled out: inside\n * `{ … }` a colon introduces a value, and the two look identical to a regex.\n */\nfunction typeContext(text: CursorText): CompletionContext | undefined {\n const found = TYPE_POSITION.exec(text.prefix);\n if (!found) return undefined;\n return { kind: \"typeName\", from: back(text.prefix, found[1]) };\n}\n\n/** `http.on ▮`: the head of the line is a verb, and an argument is due. */\nfunction argumentContext(prefix: string): CompletionContext | undefined {\n // A brace anywhere means this is a map being written, not an argument. Asked\n // outright rather than folded into the pattern as a trailing `[^{}]*$`: that\n // made the pattern describe the whole line to say something about its head.\n if (prefix.includes(\"{\") || prefix.includes(\"}\")) return undefined;\n const found = ARGUMENT.exec(prefix);\n if (!found?.[1]) return undefined;\n return { kind: \"argument\", target: found[1], from: back(prefix, trailingWord(prefix)) };\n}\n\n/**\n * `http.post url { … }`: offer the keys that call accepts. Only the map that\n * belongs to the call qualifies: a nested `{ … }` has a shape of its own that\n * the schema does not describe, so nothing is offered there rather than\n * something wrong.\n */\nfunction optionContext(text: CursorText): CompletionContext | undefined {\n const open = innermostOpenBrace(text.before);\n if (open < 0) return undefined;\n const target = OPTION_OWNER.exec(text.before.slice(0, open))?.[1];\n if (!target) return undefined;\n return { kind: \"optionKey\", target, from: back(text.prefix, trailingWord(text.prefix)) };\n}\n\n/** The `{` still open at the cursor, scanning backwards. */\nfunction innermostOpenBrace(before: string): number {\n let depth = 0;\n for (let index = before.length - 1; index >= 0; index -= 1) {\n if (before[index] === \"}\") depth += 1;\n else if (before[index] === \"{\") {\n if (depth === 0) return index;\n depth -= 1;\n }\n }\n return -1;\n}\n\nfunction stringContext(prefix: string, line: string): CompletionContext | undefined {\n const pkg = PACKAGE.exec(prefix);\n if (pkg) return { kind: \"package\", from: back(prefix, pkg[1]) };\n const path = MODULE_PATH.exec(prefix);\n if (path) return { kind: \"modulePath\", from: back(prefix, path[1]), partial: path[1] ?? \"\" };\n const named = IMPORT_NAME.exec(prefix);\n if (named)\n return { kind: \"importName\", from: back(prefix, lastName(named[1])), path: pathOf(line) };\n return undefined;\n}\n\n// The name being typed inside `{ a, b| }`: everything after the last comma.\nfunction lastName(inside: string | undefined): string {\n const tail = (inside ?? \"\").split(\",\").pop() ?? \"\";\n return tail.trimStart();\n}\n\nfunction pathOf(line: string): string | undefined {\n return FROM_PATH.exec(line)?.[1];\n}\n\nfunction back(prefix: string, partial: string | undefined): number {\n return prefix.length - (partial?.length ?? 0);\n}\n\n/**\n * The word being typed at the end of `text`, empty when the last character is\n * not part of one.\n *\n * Scanned backwards rather than matched with `/(\\w*)$/`. That pattern has\n * nothing to anchor to, so the engine tries it at every position, which is\n * quadratic in the length of the line: 27ms at ten thousand characters and\n * 454ms at forty thousand, while a completion is meant to be instant. A line is\n * as long as whoever wrote the file made it.\n */\nfunction trailingWord(text: string): string {\n let at = text.length;\n while (at > 0 && isWordCharacter(text.charCodeAt(at - 1))) at -= 1;\n return text.slice(at);\n}\n\n/** `\\w`: a digit, a letter or an underscore. */\nfunction isWordCharacter(code: number): boolean {\n if (code >= 48 && code <= 57) return true;\n if (code >= 65 && code <= 90) return true;\n if (code >= 97 && code <= 122) return true;\n return code === 95;\n}\n","import { type AstNode, isMember, prune, type Type } from \"@venn-lang/core\";\nimport { type CstNode, CstUtils, type LangiumDocument } from \"langium\";\n\nexport interface ReadFromArgs {\n /** The node the cursor's dot was found against. */\n host: AstNode;\n /** Where the cursor is: what tells a finished member from one being typed. */\n at: number;\n document: LangiumDocument;\n types: ReadonlyMap<object, Type>;\n}\n\n/**\n * The type on the left of a dot: what the members after it belong to.\n *\n * Three shapes sit here that look alike and are not: a member still being\n * typed, a member already written, and a bracket that only groups. Each is read\n * differently, which is why a plain `a.b.c.` is not the whole problem.\n */\nexport function receiverTypeAt(args: ReadFromArgs): Type | undefined {\n const node = holderOf(args.host, args.at);\n const found = args.types.get(node) ?? groupType(args);\n return found && prune(found);\n}\n\n/**\n * A member already written, told apart from one still being typed.\n *\n * `xs[0].ma▮` is half a member with no type of its own, so its receiver\n * answers. `xs[0].entries.▮` is finished and its type is the list it gives\n * back, so past the member's last character it answers for itself.\n */\nfunction holderOf(host: AstNode, at: number): AstNode {\n if (!isMember(host)) return host;\n const end = host.$cstNode?.end;\n return end !== undefined && end < at ? host : host.receiver;\n}\n\n/**\n * What a grouping `(…)` holds: `(1 + 2).▮` is a number.\n *\n * Brackets that only group carry no node of their own, so the `)` belongs to\n * the enclosing statement and the cursor lands on something untyped. A call or\n * an index does have a node ending at its bracket, so this runs only when the\n * direct reading comes up empty.\n */\nfunction groupType(args: ReadFromArgs): Type | undefined {\n const root = args.document.parseResult?.value?.$cstNode;\n if (!root) return undefined;\n const closing = before(root, args.at - 1);\n if (closing?.text !== \")\") return undefined;\n const last = before(root, closing.offset - 1)?.astNode;\n return last && outermostTyped({ from: last, end: closing.offset, types: args.types });\n}\n\nfunction before(root: CstNode, at: number): CstNode | undefined {\n return CstUtils.findLeafNodeAtOffset(root, at) ?? CstUtils.findLeafNodeBeforeOffset(root, at);\n}\n\n/**\n * The largest expression that still ends inside the brackets: `(\"a\" + \"b\").`\n * is the whole sum, not its last word. Only a node the checker gave a type to\n * counts: the tree also holds an argument list and a call ending in the same\n * place, and neither is a value anyone can read a member from.\n */\nfunction outermostTyped(args: {\n from: AstNode;\n end: number;\n types: ReadonlyMap<object, Type>;\n}): Type | undefined {\n let found: Type | undefined;\n for (let node: AstNode | undefined = args.from; node; node = node.$container) {\n if ((node.$cstNode?.end ?? args.end + 1) > args.end) break;\n found = args.types.get(node) ?? found;\n }\n return found;\n}\n","import {\n type AstNode,\n createContext,\n MEMBER_DOCS,\n memberKind,\n memberType,\n type OpaqueType,\n prune,\n resolveMember,\n showType,\n type Type,\n} from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { CompletionItem, CompletionItemKind, Range } from \"vscode-languageserver\";\nimport { findBinding } from \"../document/index.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport { ICON } from \"./icons.js\";\nimport { item } from \"./items.js\";\nimport { receiverTypeAt } from \"./read-from.js\";\n\nexport interface MemberArgs {\n /** The dotted path before the cursor's dot: `p`, `cfg.server`. */\n receiver: string;\n /** A node inside the file, for looking the head up in scope. */\n host: AstNode;\n document: LangiumDocument;\n types: TypeService;\n range: Range;\n}\n\n/**\n * What a value offers after a dot: the built-ins of its type, plus the fields it\n * carries when it is a map. Driven by the same inference the checker runs, so\n * `p` inside `people.filter(fn (p) => …)` completes as a person, not as nothing.\n */\nexport function memberItems(args: MemberArgs): CompletionItem[] {\n const type = receiverType(args);\n if (!type) return [];\n return [...fieldItems(type, args.range), ...builtinItems(type, args.range)];\n}\n\n/** Walk the path from the binding the file declared to the type it holds here. */\nfunction receiverType(args: MemberArgs): Type | undefined {\n const segments = args.receiver.split(\".\");\n const head = segments[0];\n const binding = head ? findBinding(args.host, head) : undefined;\n let type = binding && args.types.of(args.document).types.get(binding);\n for (const name of segments.slice(1)) {\n if (!type) return undefined;\n type = resolveMember(type, name, createContext());\n }\n return type && prune(type);\n}\n\n/**\n * How the editor orders what comes after a dot.\n *\n * What the value is comes before what every value of its kind can do: someone\n * who typed `price.` wants `id` and `price`, not the dozens of built-ins that\n * are the same on every map in the language.\n */\nconst OWN = \"0\";\nconst BUILT_IN = \"1\";\n\nfunction fieldItems(type: Type, range: Range): CompletionItem[] {\n if (type.kind === \"opaque\") return publishedItems(type, range);\n if (type.kind !== \"record\") return [];\n return [...type.fields].map(([name, field]) => ({\n ...item({\n label: name,\n kind: kindOf(field, true),\n range,\n detail: showType(field),\n documentation: \"Field of this map.\",\n }),\n sortText: `${OWN}${name}`,\n }));\n}\n\n/**\n * Which of three things this member is.\n *\n * The icon answers the question the reader is about to act on: do I write\n * brackets? A method needs `(…)`; everything else is written bare. Of the bare\n * ones, a field is data the value carries and a property is computed on read.\n */\nfunction kindOf(member: Type, stored: boolean): CompletionItemKind {\n if (member.kind === \"fn\") return ICON.method;\n return stored ? ICON.key : ICON.computed;\n}\n\n/**\n * What a handle publishes, and only that. A server is not a map: it answers to\n * `close`, never to `merge`, so offering `merge` would invite code that cannot\n * work.\n */\nfunction publishedItems(type: OpaqueType, range: Range): CompletionItem[] {\n return [...(type.members ?? [])].map(([name, member]) => ({\n ...item({\n label: name,\n kind: kindOf(member, false),\n range,\n detail: showType(member),\n documentation: `Published by \\`${type.name}\\`.`,\n }),\n sortText: `${OWN}${name}`,\n }));\n}\n\nfunction builtinItems(type: Type, range: Range): CompletionItem[] {\n const kind = memberKind(type);\n const docs = kind ? MEMBER_DOCS[kind] : undefined;\n if (!kind || !docs) return [];\n return Object.entries(docs).map(([name, doc]) => {\n const member = memberType(type, name, createContext());\n return {\n ...item({\n label: name,\n kind: member ? kindOf(member, false) : ICON.method,\n range,\n detail: member ? showType(member) : undefined,\n documentation: doc.example ? `${doc.doc}\\n\\n${doc.example}` : doc.doc,\n }),\n sortText: `${BUILT_IN}${name}`,\n };\n });\n}\n\n/**\n * The members of whatever the node under the cursor evaluates to.\n *\n * For a receiver no path can name (`(1234.567).`, `f(x).`, `xs[0].`) there is\n * nothing to look up by text, but the checker already typed the expression.\n */\nexport function membersOfNode(args: {\n host: AstNode;\n /** Where the cursor is: what tells a finished member from one being typed. */\n at: number;\n document: LangiumDocument;\n types: TypeService;\n range: Range;\n}): CompletionItem[] {\n const types = args.types.of(args.document).types;\n const type = receiverTypeAt({ host: args.host, at: args.at, document: args.document, types });\n if (!type) return [];\n return [...fieldItems(type, args.range), ...builtinItems(type, args.range)];\n}\n","import { type Dirent, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { type URI, UriUtils } from \"langium\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\nconst EXTENSION = \".vn\";\nconst MAX_DEPTH = 3;\nconst SKIP = new Set([\"node_modules\", \"dist\", \".git\"]);\n\nexport interface PathArgs {\n partial: string;\n base: URI;\n imports: ImportResolver;\n}\n\n/**\n * What may follow `from \"`: a `#alias/…` path from `venn.toml`, or a relative\n * path to a sibling `.vn` file. The `#` only marks an alias; plain relative\n * paths need no prefix.\n *\n * @returns Path strings ready to insert, without the surrounding quotes.\n */\nexport function modulePaths(args: PathArgs): string[] {\n return args.partial.startsWith(\"#\") ? aliasPaths(args) : relativePaths(args.base);\n}\n\nfunction aliasPaths(args: PathArgs): string[] {\n const aliases = Object.entries(args.imports.aliases(args.base));\n const matched = aliases.find(([key]) => args.partial.startsWith(`${key}/`));\n if (!matched) return aliases.map(([key]) => `${key}/`);\n const [key, folder] = matched;\n return sourceFiles(folder).map((file) => `${key}/${file}`);\n}\n\nfunction relativePaths(base: URI): string[] {\n const self = UriUtils.basename(base);\n return sourceFiles(UriUtils.dirname(base))\n .filter((file) => file !== self)\n .map((file) => `./${file}`);\n}\n\nfunction sourceFiles(folder: URI): string[] {\n return walk(folder.fsPath, \"\", 0);\n}\n\nfunction walk(root: string, relative: string, depth: number): string[] {\n if (depth > MAX_DEPTH) return [];\n const found: string[] = [];\n for (const entry of read(join(root, relative))) {\n const child = relative ? `${relative}/${entry.name}` : entry.name;\n if (entry.isDirectory() && !SKIP.has(entry.name)) found.push(...walk(root, child, depth + 1));\n else if (entry.isFile() && entry.name.endsWith(EXTENSION)) found.push(child);\n }\n return found;\n}\n\nfunction read(directory: string): Dirent[] {\n try {\n return readdirSync(directory, { withFileTypes: true });\n } catch {\n return [];\n }\n}\n","import type { ParamSpec } from \"@venn-lang/sdk\";\nimport type { Range } from \"vscode-languageserver\";\nimport { type CompletionItem, InsertTextFormat } from \"vscode-languageserver\";\nimport { ICON } from \"./icons.js\";\n\n/**\n * Where a verb's options are due: offer the map itself, then its keys.\n *\n * At `http.get(\"u\", ▮)` the braces have to exist before anything can go inside\n * them, so the map comes first and the keys after. Accepting either writes\n * `{ headers: … }` in a single step.\n */\nexport function optionsMapItems(options: readonly ParamSpec[], range: Range): CompletionItem[] {\n return [wholeMap(options, range), ...options.map((spec) => keyItem(spec, range))];\n}\n\n/** `{ … }`: the options map, with the required keys already in place. */\nfunction wholeMap(options: readonly ParamSpec[], range: Range): CompletionItem {\n const required = options.filter((spec) => spec.required);\n const inner = (required.length > 0 ? required : options.slice(0, 1))\n .map((spec, index) => `${spec.name}: \\${${index + 1}:${spec.type}}`)\n .join(\", \");\n return {\n label: \"{ … }\",\n kind: ICON.key,\n detail: `options of this call — ${options.map((spec) => spec.name).join(\", \")}`,\n insertText: `{ ${inner} }`,\n insertTextFormat: InsertTextFormat.Snippet,\n textEdit: { range, newText: `{ ${inner} }` },\n sortText: \"0\",\n };\n}\n\n/** One key, written into a fresh map so it lands somewhere valid. */\nfunction keyItem(spec: ParamSpec, range: Range): CompletionItem {\n const text = `{ ${spec.name}: $1 }`;\n return {\n label: spec.name,\n kind: ICON.key,\n detail: spec.required ? `${spec.type} (required)` : spec.type,\n documentation: spec.doc,\n insertText: text,\n insertTextFormat: InsertTextFormat.Snippet,\n textEdit: { range, newText: text },\n sortText: `1${spec.name}`,\n };\n}\n","import { BUILTIN_TYPES, type Document, isTypeDecl } from \"@venn-lang/core\";\nimport type { CompletionItem, Range } from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { ICON } from \"./icons.js\";\nimport { item } from \"./items.js\";\n\nexport interface TypeNameArgs {\n root: Document | undefined;\n catalog: SymbolCatalog;\n /** Namespaces this file brought in; a type it cannot name is not offered. */\n imported: readonly string[];\n range: Range;\n}\n\n/**\n * Every type that may be written here: the language's own, the ones this file\n * declared, and the ones its imports publish, in that order.\n */\nexport function typeNameItems(args: TypeNameArgs): CompletionItem[] {\n return [...builtins(args.range), ...declared(args), ...published(args)];\n}\n\nfunction builtins(range: Range): CompletionItem[] {\n return Object.entries(BUILTIN_TYPES).map(([name, builtin]) => ({\n ...item({\n label: name,\n kind: ICON.builtinType,\n range,\n detail: \"built in\",\n documentation: builtin.doc,\n }),\n sortText: `0${name}`,\n }));\n}\n\n/** What this file declared with `type`. */\nfunction declared(args: TypeNameArgs): CompletionItem[] {\n return (args.root?.decls ?? []).filter(isTypeDecl).map((decl) => ({\n ...item({\n label: decl.name,\n kind: ICON.type,\n range: args.range,\n detail: \"declared here\",\n }),\n sortText: `1${decl.name}`,\n }));\n}\n\n/** What the imported packages publish, written qualified, as they are used. */\nfunction published(args: TypeNameArgs): CompletionItem[] {\n return args.imported.flatMap((namespace) =>\n args.catalog.typesIn(namespace).map((entry) => ({\n ...item({\n label: `${entry.namespace}.${entry.name}`,\n kind: ICON.type,\n range: args.range,\n detail: entry.package,\n }),\n sortText: `2${entry.namespace}.${entry.name}`,\n })),\n );\n}\n","import { type AstNode, type Document, isUseDecl } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments } from \"langium\";\nimport type { CompletionProvider } from \"langium/lsp\";\nimport type {\n CompletionItem,\n CompletionList,\n CompletionParams,\n Position,\n Range,\n} from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { decosInScope } from \"../deco/index.js\";\nimport {\n exportedNames,\n hostAt,\n importedFragments,\n importedModules,\n namesInScope,\n type ScopedName,\n} from \"../document/index.js\";\nimport { envVars } from \"../env/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport {\n activeArg,\n type CallShape,\n callShape,\n enclosingBareCall,\n enclosingCall,\n enclosingMatcher,\n enclosingParenCall,\n matcherShape,\n type ShownArg,\n shapeAt,\n} from \"../signature/index.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\nimport { argumentItems, boundItems } from \"./argument-items.js\";\nimport type { CompletionContext } from \"./completion.types.js\";\nimport { contextAt } from \"./context.js\";\nimport {\n actionItems,\n annotationItems,\n envItems,\n exportItems,\n fragmentItems,\n matcherItems,\n openingItems,\n optionItems,\n packageItems,\n pathItems,\n typeItems,\n} from \"./items.js\";\nimport { memberItems, membersOfNode } from \"./member-items.js\";\nimport { modulePaths } from \"./module-paths.js\";\nimport { optionsMapItems } from \"./options-map-items.js\";\nimport { typeNameItems } from \"./type-name-items.js\";\n\n/**\n * Context-aware completion, driven by the text before the cursor.\n *\n * `contextAt` classifies the cursor, and each context has exactly one source of\n * items: a namespace's verbs, an options map's keys, the names in scope.\n */\nexport class VennCompletionProvider implements CompletionProvider {\n private readonly catalog: SymbolCatalog;\n private readonly documents: LangiumDocuments;\n private readonly imports: ImportResolver;\n private readonly types: TypeService;\n\n constructor(services: VennServices) {\n this.catalog = services.catalog;\n this.documents = services.shared.workspace.LangiumDocuments;\n this.imports = services.imports;\n this.types = services.types;\n }\n\n async getCompletion(\n document: LangiumDocument,\n params: CompletionParams,\n ): Promise<CompletionList> {\n const line = lineAt(document, params.position);\n const text = document.textDocument.getText();\n const offset = document.textDocument.offsetAt(params.position);\n const context = contextAt({\n prefix: line.slice(0, params.position.character),\n line,\n before: text.slice(0, offset),\n });\n const range = rangeOf(context, params.position);\n return { isIncomplete: false, items: await this.itemsFor(context, range, document, offset) };\n }\n\n /**\n * What follows a dot. A name the file bound wins over a plugin namespace, the\n * same rule the evaluator and the highlighter follow, so a variable named\n * `auth` completes as its own value even when `@venn-lang/auth` is loaded.\n */\n private afterDot(\n receiver: string,\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): CompletionItem[] {\n const types = this.types.of(document);\n const host = hostAt({ document, offset, types, prefer: \"before\" });\n const members = host\n ? memberItems({ receiver, host, document, types: this.types, range })\n : undefined;\n if (members?.length) return members;\n if (receiver === \"env\") return this.env(document, range);\n // A namespace answers with what it does and with what it deals in.\n return [\n ...actionItems(receiver, this.catalog, range),\n ...typeItems(receiver, this.catalog, range),\n ];\n }\n\n /**\n * What follows a dot no name can precede: `(1234.567).`, `f(x).`, `xs[0].`.\n * The receiver has no text to look up, so its inferred type answers.\n */\n private afterExpression(\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): CompletionItem[] {\n const types = this.types.of(document);\n const host = hostAt({ document, offset, types, prefer: \"before\" });\n return host ? membersOfNode({ host, at: offset, document, types: this.types, range }) : [];\n }\n\n private env(document: LangiumDocument, range: Range): CompletionItem[] {\n const uri = document.uri;\n return envItems(envVars(this.imports.env(uri), this.imports.envDocs(uri)), range);\n }\n\n private async itemsFor(\n context: CompletionContext,\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): Promise<CompletionItem[]> {\n if (context.kind === \"package\") return packageItems(this.catalog, range);\n if (context.kind === \"modulePath\") return this.paths(context.partial, range, document);\n if (context.kind === \"importName\") return this.exports(context.path, range, document);\n if (context.kind === \"action\") return this.afterDot(context.receiver, range, document, offset);\n if (context.kind === \"member\") return this.afterExpression(range, document, offset);\n if (context.kind === \"annotation\") return this.decorators(document, range);\n if (context.kind === \"fragment\") return this.fragments(range, document);\n if (context.kind === \"matcher\") return matcherItems(this.catalog, range);\n if (context.kind === \"optionKey\") {\n return optionItems({ target: context.target, catalog: this.catalog, range });\n }\n if (context.kind === \"typeName\") return this.typeNames(range, document);\n if (context.kind === \"argument\") return this.argument(context, range, document, offset);\n return this.fallback(range, document, offset);\n }\n\n /**\n * Every name in scope, with an imported one drawn as what it really is.\n *\n * `namesInScope` reads this file's tree, so it can say only that a name came\n * from an import. Its kind lives in the file it came from, which is in reach\n * here, so an imported fragment is drawn as a fragment rather than as an\n * anonymous binding.\n */\n private scopeNames(host: AstNode, at: number, document: LangiumDocument): ScopedName[] {\n const found = namesInScope(host, at);\n if (!found.some((one) => one.origin === \"import\")) return found;\n const root = rootOf(document);\n const known = root ? this.publishedTo(root, document) : new Map<string, string>();\n return found.map((one) =>\n one.origin === \"import\" ? { ...one, origin: known.get(one.name) ?? one.origin } : one,\n );\n }\n\n /** What each name this file imported was declared as, in the file it came from. */\n private publishedTo(root: Document, document: LangiumDocument): Map<string, string> {\n const graph = importedModules({\n root,\n uri: document.uri,\n documents: this.documents,\n imports: this.imports,\n });\n const known = new Map<string, string>();\n for (const module of graph.modules.values()) {\n for (const each of exportedNames(module)) known.set(each.name, each.origin);\n }\n return known;\n }\n\n /**\n * `run ▮`: the fragments this file declared, and the ones it imported.\n *\n * `run` can only invoke a fragment, so an imported name is offered only once\n * the file it came from confirms it is one.\n */\n private fragments(range: Range, document: LangiumDocument): CompletionItem[] {\n const root = rootOf(document);\n if (!root) return [];\n const graph = importedModules({\n root,\n uri: document.uri,\n documents: this.documents,\n imports: this.imports,\n });\n const imported = importedFragments({ document: root, uri: document.uri.toString(), graph });\n return fragmentItems({ document: root, imported, range });\n }\n\n /** `id: ▮`: the language's own types, this file's, and its imports'. */\n private typeNames(range: Range, document: LangiumDocument): CompletionItem[] {\n const root = rootOf(document);\n return typeNameItems({\n root,\n catalog: this.catalog,\n imported: root ? namespacesUsed(root, this.catalog) : [],\n range,\n });\n }\n\n /**\n * The last two shapes a cursor can be in before it is simply a new statement:\n * inside a call's brackets, or after a matcher word.\n */\n private fallback(range: Range, document: LangiumDocument, offset: number): CompletionItem[] {\n return (\n this.inBrackets(range, document, offset) ??\n this.afterBareCall(range, document, offset) ??\n this.afterMatcher(range, document, offset) ??\n this.opening(range, document, offset)\n );\n }\n\n /**\n * A fresh statement: the names already bound, then the words that open one.\n *\n * Calling a function is itself a statement, so bound names belong here. They\n * come first because the language's own vocabulary is always available.\n */\n private opening(range: Range, document: LangiumDocument, offset: number): CompletionItem[] {\n const host = hostAt({ document, offset, types: this.types.of(document), prefer: \"before\" });\n const bound = host ? boundItems(this.scopeNames(host, offset, document), range) : [];\n return [...bound, ...openingItems(this.catalog, range)];\n }\n\n /**\n * `const r = http.get \"u\" ▮`: a bracket-less call bound to a name.\n *\n * The `argument` context reads the head of the line, which here is `const`\n * rather than the verb. Same words deserve the same help, so it is caught\n * separately.\n */\n private afterBareCall(\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): CompletionItem[] | undefined {\n const call = enclosingBareCall(document, offset);\n const shape = call && callShape(call.target, this.catalog);\n if (!call || !shape) return undefined;\n return this.dueAt({\n active: activeArg(call, offset),\n shape,\n host: call.node,\n range,\n document,\n at: offset,\n });\n }\n\n /** What may go in this position: a value, or the options map that ends the call. */\n private dueAt(args: {\n active: number;\n shape: CallShape;\n host: AstNode;\n range: Range;\n document: LangiumDocument;\n at: number;\n }): CompletionItem[] {\n const { active, shape } = args;\n if (active >= shape.args.length && shape.options.length > 0) {\n return optionsMapItems(shape.options, args.range);\n }\n return this.valuesFor({ ...args, expects: shape.args[active] });\n }\n\n /** `expect res contains ▮`: the value the check is waiting for. */\n private afterMatcher(\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): CompletionItem[] | undefined {\n const clause = enclosingMatcher(document, offset);\n if (!clause) return undefined;\n const shape = matcherShape(clause.name, this.catalog);\n const expects = shape?.args[activeArg(clause, offset)];\n return this.valuesFor({ host: clause, expects, range, document, at: offset });\n }\n\n /**\n * `saudacao(▮)`, `fmt.json(x, ▮)`: inside a bracketed call.\n *\n * Reached last, before offering a fresh statement. Everything more specific\n * (a dot, an options key, a bare argument) has already had its turn, so what\n * is left inside brackets is a value.\n */\n private inBrackets(\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): CompletionItem[] | undefined {\n const found = enclosingParenCall(document, offset);\n if (!found?.host) return undefined;\n const shape = shapeAt({ ...found, document, catalog: this.catalog, types: this.types });\n if (!shape)\n return this.valuesFor({ host: found.host, expects: undefined, range, document, at: offset });\n return this.dueAt({\n active: found.active,\n shape,\n host: found.host,\n range,\n document,\n at: offset,\n });\n }\n\n /**\n * `http.on ▮`: what the program already holds, before what the stdlib offers.\n * A name the text took for a verb but the language does not know is not an\n * argument position at all, so that falls back to a fresh statement.\n */\n private argument(\n context: { target: string; from: number },\n range: Range,\n document: LangiumDocument,\n offset: number,\n ): CompletionItem[] {\n const shape = callShape(context.target, this.catalog);\n const call = enclosingCall(document, offset);\n // The text took the head of the line for a verb and the language disagrees:\n // `const t = saudacao(▮)` reads that way and is a bracketed call.\n if (!shape || !call) {\n return this.fallback(range, document, offset);\n }\n const expects = shape.args[activeArg(call, offset)];\n return this.valuesFor({ host: call, expects, range, document, at: offset });\n }\n\n /** What the program holds that could go here, the fitting ones first. */\n private valuesFor(args: {\n host: AstNode;\n expects: ShownArg | undefined;\n range: Range;\n document: LangiumDocument;\n at: number;\n }): CompletionItem[] {\n return argumentItems({\n names: this.scopeNames(args.host, args.at, args.document),\n types: this.types.of(args.document).types,\n expects: args.expects,\n catalog: this.catalog,\n range: args.range,\n });\n }\n\n // The built-ins, the `deco`s this file declares, and the `pub deco`s it imported.\n private async decorators(document: LangiumDocument, range: Range): Promise<CompletionItem[]> {\n const scope = { document, documents: this.documents, imports: this.imports };\n return annotationItems(await decosInScope(scope), range);\n }\n\n private paths(partial: string, range: Range, document: LangiumDocument): CompletionItem[] {\n const paths = modulePaths({ partial, base: document.uri, imports: this.imports });\n return pathItems(paths, range);\n }\n\n // Only what the imported module marks `pub` may be named inside `import { … }`.\n private async exports(\n path: string | undefined,\n range: Range,\n document: LangiumDocument,\n ): Promise<CompletionItem[]> {\n if (!path) return [];\n const uri = this.imports.resolve(path, document.uri);\n const target = await this.documents.getOrCreateDocument(uri).catch(() => undefined);\n const root = target?.parseResult?.value as Document | undefined;\n return root ? exportItems(exportedNames(root), range) : [];\n }\n}\n\nfunction rangeOf(context: CompletionContext, position: Position): Range {\n return { start: { line: position.line, character: context.from }, end: position };\n}\n\nfunction rootOf(document: LangiumDocument): Document | undefined {\n return document.parseResult?.value as Document | undefined;\n}\n\nfunction lineAt(document: LangiumDocument, position: Position): string {\n const text = document.textDocument.getText();\n const start = document.textDocument.offsetAt({ line: position.line, character: 0 });\n const end = text.indexOf(\"\\n\", start);\n return text.slice(start, end < 0 ? text.length : end);\n}\n\n/** The namespaces this file brought in; a type it cannot name is not offered. */\nfunction namespacesUsed(root: Document, catalog: SymbolCatalog): string[] {\n const names: string[] = [];\n for (const decl of root.imports) {\n if (!isUseDecl(decl)) continue;\n const namespace = decl.alias ?? catalog.namespaceOfPackage(decl.pkg);\n if (namespace) names.push(namespace);\n }\n return names;\n}\n","import { type AstNode, isAnnotation, isRef, isRunStmt, isValueImport } from \"@venn-lang/core\";\nimport { CstUtils, type LangiumDocument, type LangiumDocuments, type URI } from \"langium\";\nimport type { DefinitionProvider } from \"langium/lsp\";\nimport type { DefinitionParams, LocationLink } from \"vscode-languageserver\";\nimport { decoNamed } from \"../deco/index.js\";\nimport { findBinding, interpolationAt, resolveFragment } from \"../document/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\nconst ORIGIN = { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };\n\n/** Ctrl+Click: `run` fragments (local or imported), bindings, and imported files. */\nexport class VennDefinitionProvider implements DefinitionProvider {\n private readonly documents: LangiumDocuments;\n private readonly imports: ImportResolver;\n\n constructor(services: VennServices) {\n this.documents = services.shared.workspace.LangiumDocuments;\n this.imports = services.imports;\n }\n\n async getDefinition(\n document: LangiumDocument,\n params: DefinitionParams,\n ): Promise<LocationLink[] | undefined> {\n const root = document.parseResult?.value?.$cstNode;\n if (!root) return undefined;\n const offset = document.textDocument.offsetAt(params.position);\n const inString = this.interpolated({ document, offset });\n if (inString) return [inString];\n const node = CstUtils.findLeafNodeAtOffset(root, offset)?.astNode;\n const link = node && (await this.resolve(node, document));\n return link ? [link] : undefined;\n }\n\n /** `\"${base}/users\"`: the name inside the placeholder is a real reference. */\n private interpolated(args: {\n document: LangiumDocument;\n offset: number;\n }): LocationLink | undefined {\n const hit = interpolationAt(args);\n if (!hit?.isHead) return undefined;\n return localLink(findBinding(hit.host, hit.name), args.document);\n }\n\n private async resolve(\n node: AstNode,\n document: LangiumDocument,\n ): Promise<LocationLink | undefined> {\n if (isRunStmt(node)) return this.fragment(node.target, document);\n if (isAnnotation(node)) return this.decorator(node.name, document);\n if (isRef(node)) return localLink(findBinding(node, node.name), document);\n if (isValueImport(node)) return fileLink(this.imports.resolve(node.path, document.uri));\n return undefined;\n }\n\n // `@memoize` lands on the `deco memoize` that defines it, here or across an\n // import. A built-in has no source to land on, so nothing happens.\n private async decorator(\n name: string,\n document: LangiumDocument,\n ): Promise<LocationLink | undefined> {\n const scope = { document, documents: this.documents, imports: this.imports };\n const found = await decoNamed(name, scope);\n return found?.document ? localLink(found.decl, found.document) : undefined;\n }\n\n // Land on the declaration when the file can be read; otherwise open the file.\n private async fragment(\n name: string,\n document: LangiumDocument,\n ): Promise<LocationLink | undefined> {\n const location = await resolveFragment({\n name,\n document,\n documents: this.documents,\n imports: this.imports,\n });\n if (!location) return undefined;\n const precise = location.document && localLink(location.decl, location.document);\n return precise ?? fileLink(location.uri);\n }\n}\n\nfunction localLink(node: AstNode | undefined, document: LangiumDocument): LocationLink | undefined {\n const range = node?.$cstNode?.range;\n if (!range) return undefined;\n return { targetUri: document.uri.toString(), targetRange: range, targetSelectionRange: range };\n}\n\nfunction fileLink(uri: URI): LocationLink {\n return { targetUri: uri.toString(), targetRange: ORIGIN, targetSelectionRange: ORIGIN };\n}\n","import { formatOptionsFrom, formatText } from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { Formatter } from \"langium/lsp\";\nimport type {\n DocumentFormattingParams,\n DocumentOnTypeFormattingOptions,\n DocumentOnTypeFormattingParams,\n DocumentRangeFormattingParams,\n FormattingOptions,\n Range,\n TextEdit,\n} from \"vscode-languageserver\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\n/**\n * Formatting runs through `@venn-lang/core`, so the editor and `venn fmt` produce\n * byte-identical output. Project settings come from `[format]` in `venn.toml`;\n * the editor's own indent settings fill in what the project left unset.\n */\nexport class VennFormatter implements Formatter {\n private readonly imports: ImportResolver;\n\n constructor(services: VennServices) {\n this.imports = services.imports;\n }\n\n /** Re-indent the line as soon as a block is closed. */\n get formatOnTypeOptions(): DocumentOnTypeFormattingOptions {\n return { firstTriggerCharacter: \"}\", moreTriggerCharacter: [\"\\n\"] };\n }\n\n formatDocument(document: LangiumDocument, params: DocumentFormattingParams): TextEdit[] {\n return this.rewrite(document, params.options);\n }\n\n formatDocumentRange(\n document: LangiumDocument,\n params: DocumentRangeFormattingParams,\n ): TextEdit[] {\n return this.rewrite(document, params.options);\n }\n\n formatDocumentOnType(\n document: LangiumDocument,\n params: DocumentOnTypeFormattingParams,\n ): TextEdit[] {\n return this.rewrite(document, params.options);\n }\n\n // One whole-document edit: the header may move lines, so per-line edits cannot\n // express the result.\n private rewrite(document: LangiumDocument, editor: FormattingOptions): TextEdit[] {\n const source = document.textDocument.getText();\n const project = formatOptionsFrom(this.imports.formatSettings(document.uri));\n const formatted = formatText(source, { ...fromEditor(editor), ...project });\n return formatted === source ? [] : [{ range: whole(document), newText: formatted }];\n }\n}\n\nfunction fromEditor(options: FormattingOptions): { indentWidth: number; useTabs: boolean } {\n return { indentWidth: options.tabSize, useTabs: !options.insertSpaces };\n}\n\nfunction whole(document: LangiumDocument): Range {\n const text = document.textDocument;\n return { start: { line: 0, character: 0 }, end: text.positionAt(text.getText().length) };\n}\n","import {\n type AstNode,\n type Document,\n type FnDecl,\n isCall,\n isFnDecl,\n isMember,\n isRef,\n} from \"@venn-lang/core\";\nimport { AstUtils } from \"langium\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\n\n/**\n * Which functions in a file wait for something.\n *\n * A plugin verb runs asynchronously, so anything that reaches for one hands\n * back a value still arriving, and so does anything that calls that. The\n * runtime does the waiting without a word being written; this is what lets the\n * hover say so.\n *\n * It lives here rather than in the checker because deciding whether a dotted\n * path names a verb needs the plugin registry, and `@venn-lang/core` deliberately\n * knows nothing about plugins. Being an editor's answer, it may be approximate:\n * missing one costs a hint, never a wrong program.\n */\nexport function waitingFns(document: Document, catalog: SymbolCatalog): ReadonlySet<string> {\n const bodies = declaredFns(document);\n const waiting = new Set<string>();\n for (const [name, decl] of bodies) {\n if (callsAVerb(decl, catalog)) waiting.add(name);\n }\n spread(bodies, waiting);\n return waiting;\n}\n\nfunction declaredFns(document: Document): Map<string, FnDecl> {\n const out = new Map<string, FnDecl>();\n for (const decl of document.decls) {\n if (isFnDecl(decl)) out.set(decl.name, decl);\n }\n return out;\n}\n\n/** A verb somewhere in the body, whether named or called. */\nfunction callsAVerb(decl: FnDecl, catalog: SymbolCatalog): boolean {\n for (const node of AstUtils.streamAst(decl.body)) {\n const head = pathHead(node);\n if (head && catalog.hasNamespace(head)) return true;\n }\n return false;\n}\n\n/**\n * Then outwards, until nothing new is found: a function that calls one that\n * waits, waits. Bounded by the number of functions, so it always settles.\n */\nfunction spread(bodies: Map<string, FnDecl>, waiting: Set<string>): void {\n for (let pass = 0; pass < bodies.size; pass += 1) {\n let grew = false;\n for (const [name, decl] of bodies) {\n if (waiting.has(name)) continue;\n if (!callsAnyOf(decl, waiting)) continue;\n waiting.add(name);\n grew = true;\n }\n if (!grew) return;\n }\n}\n\nfunction callsAnyOf(decl: FnDecl, names: ReadonlySet<string>): boolean {\n for (const node of AstUtils.streamAst(decl.body)) {\n if (isCall(node) && isRef(node.callee) && names.has(node.callee.name)) return true;\n }\n return false;\n}\n\n/** The first name of a dotted path: `http` in `http.get`, `fmt` in `fmt.json`. */\nfunction pathHead(node: AstNode): string | undefined {\n if (!isMember(node)) return undefined;\n let receiver = node.receiver;\n while (isMember(receiver)) receiver = receiver.receiver;\n return isRef(receiver) ? receiver.name : undefined;\n}\n","import { fence, rule, sections } from \"../markdown/index.js\";\n\ninterface KeywordDoc {\n summary: string;\n example?: string;\n}\n\n// What every word of the kernel does. The grammar is fixed and small, so this\n// table is the whole language: a newcomer can learn it by hovering.\nconst KEYWORDS: Record<string, KeywordDoc> = {\n module: {\n summary: \"Name this file. Purely documentation; imports resolve by path, not by module name.\",\n example: \"module checkout.payment\",\n },\n use: {\n summary: \"Load a plugin package, making its namespace available as verbs.\",\n example: 'use \"venn/http\"\\nuse \"venn/browser\" as b',\n },\n import: {\n summary: \"Bring `pub` fragments and functions from another `.vn` file into this one.\",\n example: 'import { login } from \"./shared/auth.vn\"',\n },\n from: {\n summary: \"The module an `import` reads from: a relative path or a `#alias` from `venn.toml`.\",\n },\n as: {\n summary: \"Rename what you just bound — a `use` namespace, a `repeat` index or a `run` result.\",\n },\n pub: {\n summary: \"Export this declaration so other files may `import` it.\",\n example: \"pub fragment login(user) { … }\",\n },\n flow: {\n summary: \"A test: the top-level unit the runner schedules and reports.\",\n example:\n 'flow \"Checkout\" {\\n step \"Pay\" {\\n const paid = http.post \"/pay\"\\n expect paid.status == 200\\n }\\n}',\n },\n step: {\n summary: \"One named unit of work inside a flow. Bindings made inside it are step-local.\",\n example: 'step \"Ping\" {\\n const health = http.get \"/health\"\\n expect health.status == 200\\n}',\n },\n group: {\n summary: \"Label a set of steps. Structure only — it changes no scope.\",\n example: 'group \"payment\" {\\n step \"Charge\" { … }\\n}',\n },\n fragment: {\n summary: \"A reusable block of steps, invoked with `run`. Composition without inheritance.\",\n example: 'fragment login(user) {\\n step \"login\" { … }\\n}',\n },\n fn: {\n summary:\n \"A pure function returning a value — first-class, callable anywhere. `=> expr` for one line; a `{ … }` block returns its last expression. No steps, no I/O.\",\n example: \"fn double(x) => x * 2\\nconst add = fn (a, b) => a + b\",\n },\n deco: {\n summary:\n \"Declare a decorator. The first parameter is the target, and the type written on it is what `@name` may sit on — `Fn`, `Flow`, `Step`, `Binding`, `Type`, `Resource`, or `Node` for anything. The parameters after it are the decorator's own arguments. The body runs before the program exists, so it is pure: no plugin verbs.\",\n example:\n 'deco memoize(target: Fn) {\\n const cache = {}\\n target.wrap(fn (call, args) => cache.get(str(args)) ?? call(args))\\n}\\n\\npub deco retry(target: Flow, times: number) {\\n target.meta \"retry\" times\\n}',\n },\n run: {\n summary: \"Invoke a fragment, optionally binding what it returns.\",\n example: 'run login(\"alice\") as session',\n },\n expect: {\n summary:\n \"Assert. Takes a boolean, or a subject plus a matcher. `.all { … }` groups checks; `.soft` records without aborting.\",\n example: 'expect health.status == 200\\nexpect user.plan oneOf [\"free\", \"pro\"]',\n },\n not: { summary: \"Negate the expectation that follows.\", example: \"expect not orders empty\" },\n all: { summary: \"Group several checks under one `expect`, each on its own line.\" },\n soft: { summary: \"Record a failed expectation without aborting the step.\" },\n let: { summary: \"Bind a value for the rest of the block.\", example: 'let plan = \"pro\"' },\n const: { summary: \"Bind a value that cannot be reassigned.\", example: \"const retries = 3\" },\n capture: {\n summary:\n \"Removed. It did exactly what `let` does — use `let` for a value that changes, `const` for one that does not.\",\n example: \"const orderId = order.json.id\",\n },\n env: {\n summary:\n \"Configuration for this run, read from the `[env.*]` tables of `venn.toml`. `--env <name>` picks which table; `env.name` is the one that was picked.\",\n example:\n 'use \"venn/env\"\\n\\nconst token = http.post \"${env.BASE_URL}/token\" {\\n body: { user: env.USERNAME, pass: env.PASSWORD },\\n encode: \"form\"\\n}',\n },\n resource: {\n summary:\n \"Open something with a lifecycle, closed automatically. `@scope` sets how long it lives.\",\n example: \"@scope(flow)\\nresource page = browser.newContext\",\n },\n config: {\n summary: \"Project settings visible to plugins, such as `baseUrl`.\",\n example: \"config { baseUrl: env.BASE_URL }\",\n },\n matrix: {\n summary: \"Run every flow once per combination of these values.\",\n example: 'matrix { browser: [\"chromium\", \"webkit\"] }',\n },\n dataset: { summary: \"A named collection of test data.\" },\n factory: { summary: \"A named builder for objects, usually backed by `@venn-lang/data`.\" },\n type: {\n summary: \"A named shape, used to type parameters and datasets.\",\n example: \"type User { email: string }\",\n },\n report: { summary: \"Where results go.\", example: 'report junit(\"./out\")' },\n if: {\n summary: \"Branch on a condition.\",\n example: 'if health.status == 200 {\\n step \"ok\" { … }\\n} else {\\n step \"retry\" { … }\\n}',\n },\n else: { summary: \"The branch taken when the `if` condition is false.\" },\n forEach: {\n summary: \"Repeat the body once per item. The optional map sets `concurrency`.\",\n example: 'forEach user in users { concurrency: 4 } {\\n step \"check\" { … }\\n}',\n },\n in: {\n summary: \"Separates the loop variable from its list, and tests membership in an expression.\",\n },\n repeat: {\n summary: \"Run the body a fixed number of times, optionally binding the 1-based index.\",\n example: 'repeat 3 as attempt {\\n step \"poll\" { … }\\n}',\n },\n while: { summary: \"Repeat while a condition holds. Every loop inherits a timeout.\" },\n parallel: {\n summary: \"Run the statements concurrently and wait for all of them.\",\n example: 'parallel { concurrency: 4 } {\\n step \"a\" { … }\\n step \"b\" { … }\\n}',\n },\n race: {\n summary: \"Run concurrently; the first to finish wins and the others are cancelled.\",\n example: 'race { timeout: 10s } {\\n step \"ws\" { … }\\n step \"poll\" { … }\\n}',\n },\n try: { summary: \"Attempt the body, handling failure in `catch` and cleanup in `finally`.\" },\n catch: { summary: \"Handle a failure from `try`, optionally binding the error.\" },\n finally: { summary: \"Always runs after `try`, whether it failed or not.\" },\n defer: {\n summary: \"Schedule cleanup that runs on the way out of the block, even on failure.\",\n example: 'defer { db.exec \"ROLLBACK\" }',\n },\n setup: { summary: \"Runs once before every flow in the file.\" },\n teardown: { summary: \"Runs once after every flow in the file.\" },\n beforeEach: { summary: \"Runs before each flow.\" },\n afterEach: { summary: \"Runs after each flow.\" },\n on: {\n summary: \"React to a lifecycle event.\",\n example: \"on failure {\\n artifacts.save trace\\n}\",\n },\n return: {\n summary:\n \"Return a value early. A `fn` already returns its last expression, so `return` is only needed to leave sooner; it also stops a fragment.\",\n },\n break: { summary: \"Leave the innermost loop.\" },\n continue: { summary: \"Skip to the next iteration of the innermost loop.\" },\n true: { summary: \"The boolean true.\" },\n false: { summary: \"The boolean false.\" },\n null: { summary: \"The absence of a value.\" },\n};\n\n/** Hover for a keyword of the kernel: what it does, and how it reads. */\nexport function keywordHover(word: string): string | undefined {\n const doc = KEYWORDS[word];\n if (!doc) return undefined;\n const example = doc.example ? sections([\"**Example**\", fence(doc.example)]) : undefined;\n return rule([fence(word), sections([doc.summary, example])]);\n}\n\n/** Whether the kernel documents this word at all. */\nexport function isKeyword(word: string): boolean {\n return word in KEYWORDS;\n}\n","import {\n createContext,\n MEMBER_DOCS,\n memberKind,\n memberType,\n PRELUDE_SPECS,\n type PreludeArg,\n resolveMember,\n showType,\n type Type,\n} from \"@venn-lang/core\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { code, fence, labelled, rule, sections } from \"../markdown/index.js\";\n\n/**\n * Hover for a prelude name: `range`, `str`, `print`. They belong to no\n * namespace and are declared nowhere, so without this they read as an unknown\n * variable of type `dynamic`.\n */\nexport function preludeHover(name: string): string | undefined {\n const spec = PRELUDE_SPECS[name];\n if (!spec) return undefined;\n return rule([\n fence(spec.signature),\n sections([spec.doc, argumentsBlock(spec.args), example(spec.example)]),\n \"**Prelude** — available without `use`.\",\n ]);\n}\n\n/** One line per argument, laid out as an action's is; a verb is a verb. */\nfunction argumentsBlock(args: readonly PreludeArg[] | undefined): string | undefined {\n if (!args?.length) return undefined;\n const lines = args.map((arg) => {\n const doc = arg.doc ? ` — ${arg.doc}` : \"\";\n return `- ${code(arg.name)}: ${code(arg.type)}${arg.optional ? \" *(optional)*\" : \"\"}${doc}`;\n });\n return labelled(\"Arguments\", lines.join(\"\\n\"));\n}\n\n/**\n * Hover for a namespace itself (`fmt`, `http`). A namespace is not a map: it is\n * the set of verbs a package contributes, and saying so keeps anyone from\n * reading its members like data.\n */\nexport function namespaceHover(name: string, catalog: SymbolCatalog): string | undefined {\n if (!catalog.hasNamespace(name)) return undefined;\n const actions = catalog.actionsIn(name);\n const shown = actions.slice(0, 8).map((entry) => code(`${name}.${entry.name}`));\n const more = actions.length > shown.length ? `, …${actions.length - shown.length} more` : \"\";\n return rule([\n fence(`namespace ${name}`),\n sections([\n `Contributes ${actions.length} verb${actions.length === 1 ? \"\" : \"s\"}.`,\n actions.length > 0 ? labelled(\"Verbs\", `${shown.join(\", \")}${more}`) : undefined,\n ]),\n `**Package** ${catalog.packagesFor(name).map(code).join(\", \")}`,\n ]);\n}\n\n/**\n * Hover for a built-in member of a native value: `xs.map`, `name.slugify`.\n * The signature comes from the receiver's inferred type, so `xs.first` on a\n * `list<number>` reads as `number`, not as a type variable.\n */\nexport function memberHover(args: { receiver: Type; member: string }): string | undefined {\n const kind = memberKind(args.receiver);\n const doc = kind && MEMBER_DOCS[kind]?.[args.member];\n if (!doc) return fieldHover(args);\n if (!kind) return undefined;\n const type = memberType(args.receiver, args.member, createContext());\n const shown = type ? ` -> ${showType(type)}` : \"\";\n return rule([\n fence(`${kind}.${args.member}${shown}`),\n sections([doc.doc, example(doc.example)]),\n `**Built in** — on every ${code(kind)}.`,\n ]);\n}\n\n/** A key the data itself carries: `p.age` on `{ name: string, age: number }`. */\nfunction fieldHover(args: { receiver: Type; member: string }): string | undefined {\n const type = resolveMember(args.receiver, args.member, createContext());\n if (!type) return undefined;\n return rule([\n fence(`${args.member}: ${showType(type)}`),\n `**Field** of ${code(showType(args.receiver))}.`,\n shaping(type),\n ]);\n}\n\n/**\n * How to get somewhere from a value nothing can know the shape of.\n *\n * `dynamic` is honest: a parsed response is whatever the far end sent, and no\n * checker can say more. Honesty without a way forward reads as a dead end, so\n * the hover spells out the way: name a type and annotate the binding.\n */\nfunction shaping(type: Type): string | undefined {\n if (type.kind !== \"dynamic\") return undefined;\n return [\n \"**Shape it by naming one** — nothing can know what this holds, so say what you expect:\",\n fence(\"type Price { symbol: string, price: number }\\nconst price: Price = res.json\"),\n \"From there it reads as a `Price`: members are offered, and a wrong one is an error.\",\n ].join(\"\\n\\n\");\n}\n\nfunction example(source: string | undefined): string | undefined {\n return source ? labelled(\"Example\", fence(source)) : undefined;\n}\n","import { type ParamSpec, paramSpecs } from \"@venn-lang/sdk\";\nimport type { ActionEntry, MatcherEntry, SymbolCatalog } from \"../catalog/index.js\";\nimport { code, fence, labelled, rule, sections } from \"../markdown/index.js\";\nimport { callShape, type ShownArg, shownArgs } from \"../signature/index.js\";\nimport { preludeHover } from \"./render-symbol.js\";\n\n/** Hover for `namespace.action`, or for a prelude verb like `log`. */\nexport function actionHover(target: string, catalog: SymbolCatalog): string | undefined {\n const dot = target.indexOf(\".\");\n if (dot < 0) return preludeHover(target);\n const entry = catalog.action(target.slice(0, dot), target.slice(dot + 1));\n return entry && renderAction(entry, catalog);\n}\n\n/** Hover for a bareword matcher used after `expect`. */\nexport function matcherHover(name: string, catalog: SymbolCatalog): string | undefined {\n const entry = catalog.matcher(name);\n return entry && renderMatcher(entry);\n}\n\nfunction renderAction(entry: ActionEntry, catalog: SymbolCatalog): string {\n const target = `${entry.namespace}.${entry.name}`;\n const shape = callShape(target, catalog);\n const returns = shape?.returns ? ` -> ${shape.returns}` : \"\";\n const body = sections([\n entry.action.doc,\n argumentsBlock(shape?.args ?? []),\n optionsBlock(paramSpecs(entry.action.params)),\n ]);\n return rule([\n fence(`${signatureLine(target, shape?.args ?? [])}${returns}`),\n body || undefined,\n WHAT_IT_IS,\n `**Package** ${code(entry.package)}`,\n ]);\n}\n\n/**\n * What kind of thing this is, said outright.\n *\n * A `fn` hover carries the word `fn` and needs no explaining. A verb carries\n * nothing that tells it apart from a function the reader could hold, which is\n * exactly what it is not.\n */\nconst WHAT_IT_IS =\n \"**Verb** — a package contributes it, it reaches the world outside, and the program waits for it without saying so. Naming it calls it; it is not a value you can hold.\";\n\n/** The call as it is written: `http.on server handler`, with no brackets. */\nfunction signatureLine(target: string, args: readonly ShownArg[]): string {\n const written = args.map((each) => (each.optional ? `${each.name}?` : each.name)).filter(Boolean);\n return [target, ...written].join(\" \");\n}\n\n/** One line per positional argument: the half a Zod schema never describes. */\nfunction argumentsBlock(args: readonly ShownArg[]): string | undefined {\n const named = args.filter((each) => each.name);\n if (named.length === 0) return undefined;\n return labelled(\"Arguments\", named.map(argumentLine).join(\"\\n\"));\n}\n\nfunction argumentLine(arg: ShownArg): string {\n const optional = arg.optional ? \" *(optional)*\" : \"\";\n const doc = arg.doc ? ` — ${arg.doc}` : \"\";\n return `- ${code(arg.name)}: ${code(arg.type)}${optional}${doc}`;\n}\n\nfunction renderMatcher(entry: MatcherEntry): string {\n const applies = entry.matcher.appliesTo\n ? `Applies to ${code(entry.matcher.appliesTo)}.`\n : undefined;\n const args = shownArgs(entry.matcher.args ?? []);\n const body = sections([\n applies,\n argumentsBlock(args),\n optionsBlock(paramSpecs(entry.matcher.params)),\n ]);\n return rule([\n fence(signatureLine(`expect <subject> ${entry.name}`, args)),\n body || undefined,\n `**Package** ${code(entry.package)}`,\n ]);\n}\n\n/** One line per key: what to write, whether it is required, and what it means. */\nfunction optionsBlock(specs: ParamSpec[]): string | undefined {\n if (specs.length === 0) return undefined;\n return labelled(\"Options\", specs.map(optionLine).join(\"\\n\"));\n}\n\nfunction optionLine(spec: ParamSpec): string {\n const required = spec.required ? \" *(required)*\" : \"\";\n const doc = spec.doc ? ` — ${spec.doc}` : \"\";\n return `- ${code(spec.name)}: ${code(spec.type)}${required}${doc}`;\n}\n","import { type AstNode, isExpr, prune, showType, type Type } from \"@venn-lang/core\";\nimport { AstUtils, type CstNode } from \"langium\";\nimport type { TypeService } from \"../types/index.js\";\n\n/** The inferred type of a node: `list<number>`, `fn(number) -> number`. */\nexport function typeLabel(node: AstNode | undefined, types: TypeService): string | undefined {\n if (!node) return undefined;\n const found = types.of(AstUtils.getDocument(node)).types.get(node);\n return found ? spread(found) : undefined;\n}\n\n/** Past this many fields a shape stops reading as a line and starts reading as a wall. */\nconst INLINE_FIELDS = 3;\n\n/**\n * The same type, one field per line once there are enough of them to matter.\n *\n * A diagnostic wants a type on one line, which is what `showType` gives. A\n * hover has room, and a decorator handle carrying ten verbs on one line is\n * exactly as much use as no hover at all.\n */\nfunction spread(type: Type): string {\n const pruned = prune(type);\n if (pruned.kind !== \"record\" || pruned.fields.size <= INLINE_FIELDS) return showType(pruned);\n const fields = [...pruned.fields].map(([name, field]) => ` ${name}: ${showType(field)},`);\n return `{\\n${fields.join(\"\\n\")}\\n}`;\n}\n\n/**\n * The type of the expression a token belongs to, as a hover. Used when nothing\n * else describes the token, so hovering `.len` or a literal still answers.\n */\nexport function inferredType(leaf: CstNode, types: TypeService): string | undefined {\n if (!carriesMeaning(leaf.text)) return undefined;\n const known = types.of(AstUtils.getDocument(leaf.astNode)).types;\n const type = nearestType(leaf, known);\n return type ? `\\`\\`\\`venn\\n${showType(type)}\\n\\`\\`\\`` : undefined;\n}\n\nconst NAME_OR_LITERAL = /^([A-Za-z_]\\w*|\\d|[\"'])/;\n\n/**\n * Only a name or a literal describes a value. A bracket or a comma belongs to\n * the expression around it, so answering for one would make hovering `(`\n * report the type of whatever it encloses.\n */\nfunction carriesMeaning(text: string): boolean {\n return NAME_OR_LITERAL.test(text);\n}\n\n/** Walk from the token's node outward to the nearest expression that has a type. */\nfunction nearestType(leaf: CstNode, types: ReadonlyMap<AstNode, Type>): Type | undefined {\n let node: AstNode | undefined = leaf.astNode;\n while (node) {\n if (isExpr(node)) {\n const type = types.get(node);\n if (type) return type;\n }\n node = node.$container;\n }\n return undefined;\n}\n","import {\n type AstNode,\n type FnDecl,\n type FragmentDecl,\n isCaptureStmt,\n isDatasetDecl,\n isDecoDecl,\n isFnDecl,\n isFnExpr,\n isForEachStmt,\n isFragmentDecl,\n isLetStmt,\n isParam,\n isRepeatStmt,\n type ParamList,\n type UseDecl,\n} from \"@venn-lang/core\";\nimport { type LangiumDocument, UriUtils } from \"langium\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { readDoc, renderDoc } from \"../docs/index.js\";\nimport { type FragmentLocation, findBinding } from \"../document/index.js\";\nimport { code, fence, rule, sections } from \"../markdown/index.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport { typeLabel } from \"./type-hover.js\";\n\n/** Hover for a fragment: its signature, its documentation, and where it lives. */\nexport function fragmentHover(location: FragmentLocation): string {\n const file = code(UriUtils.basename(location.uri));\n if (!location.decl || !location.document) {\n return rule([fence(\"fragment …\"), `Imported from ${file}.`]);\n }\n const { decl, document } = location;\n const params = (decl.params?.params ?? []).map((param) => param.name).join(\", \");\n const signature = `${decl.export ? \"pub \" : \"\"}fragment ${decl.name}(${params})`;\n return rule([fence(signature), renderDoc(readDoc(document, decl)), `Declared in ${file}`]);\n}\n\n/** Hover for a variable reference, resolved to whatever binds it. */\nexport function bindingHover(args: {\n document: LangiumDocument;\n node: AstNode;\n name: string;\n types: TypeService;\n waiting?: ReadonlySet<string>;\n}): string | undefined {\n const binding = findBinding(args.node, args.name);\n return binding && renderBinding({ ...args, binding });\n}\n\n/** Hover on the declaration itself (`let plan = …`, `resource db = …`). */\nexport function declarationHover(args: {\n document: LangiumDocument;\n node: AstNode;\n types: TypeService;\n /** Names of the functions in this file that wait for something. */\n waiting?: ReadonlySet<string>;\n}): string | undefined {\n const name = declaredName(args.node);\n if (name === undefined) return undefined;\n return renderBinding({ ...args, binding: args.node, name });\n}\n\n/** Hover for `use \"venn/http\"`: what the package contributes. */\nexport function useHover(decl: UseDecl, catalog: SymbolCatalog): string | undefined {\n const namespace = catalog.namespaceOfPackage(decl.pkg);\n if (!namespace) return rule([fence(`use \"${decl.pkg}\"`), \"Package is not loaded.\"]);\n const count = catalog.actionsIn(namespace).length;\n const alias = decl.alias ? ` as ${decl.alias}` : \"\";\n const verbs = `Contributes ${count} action${count === 1 ? \"\" : \"s\"} under ${code(namespace)}.`;\n return rule([fence(`use \"${decl.pkg}\"${alias}`), verbs]);\n}\n\nfunction renderBinding(args: {\n document: LangiumDocument;\n binding: AstNode;\n name: string;\n types: TypeService;\n waiting?: ReadonlySet<string>;\n}): string {\n const { document, binding, name } = args;\n const waits = Boolean(args.waiting?.has(name)) && isFnDecl(binding);\n const body = sections([renderDoc(readDoc(document, binding)), describe(binding), waited(waits)]);\n return rule([fence(signatureOf(binding, name, args.types, waits)), body || undefined]);\n}\n\n/**\n * Said plainly, because nothing in the source says it. The runtime waits for\n * this on its own, with no keyword written, so the editor is the only place a\n * reader can find out.\n */\nfunction waited(waits: boolean): string | undefined {\n if (!waits) return undefined;\n return \"**Waits** — it reaches for a plugin verb, so it hands back a value that is still arriving. Anything that binds it with `let` gets the value.\";\n}\n\nfunction declaredName(node: AstNode): string | undefined {\n if (isLetStmt(node) || isCaptureStmt(node)) return node.name;\n if (isFnDecl(node)) return node.name;\n if (isDatasetDecl(node)) return node.name;\n return isParam(node) ? node.name : undefined;\n}\n\n/** The signature line, carrying the inferred type when the checker knows one. */\nfunction signatureOf(binding: AstNode, name: string, types: TypeService, waits = false): string {\n // `~>` rather than `->`: the arrow says the answer takes a moment.\n const type = waiting(typeLabel(binding, types), waits);\n const typed = type ? `: ${type}` : \"\";\n if (isFnDecl(binding))\n return `${binding.export ? \"pub \" : \"\"}fn ${written(binding, name)}${typed}`;\n if (isLetStmt(binding)) return `${binding.kind} ${name}${typed}`;\n if (isCaptureStmt(binding)) return `capture ${name}`;\n if (isDatasetDecl(binding)) return `dataset ${name}`;\n if (isFragmentDecl(binding)) return `fragment ${written(binding, name)}`;\n if (isParam(binding)) return `${name}${typed || \": parameter\"}`;\n return name;\n}\n\n/**\n * The name with the parameter list the source actually wrote.\n *\n * The type alone says `fn(a, b) -> a`, which tells the reader how many and not\n * which. The names are right there in the declaration, and they are the half a\n * caller has to get right.\n */\nfunction written(binding: FnDecl | FragmentDecl, name: string): string {\n const names = (binding.params?.params ?? []).map((param) => param.name);\n return `${name}(${names.join(\", \")})`;\n}\n\nfunction waiting(type: string | undefined, waits: boolean): string | undefined {\n return type && waits ? type.replace(\" -> \", \" ~> \") : type;\n}\n\n/** Where a parameter came from: a function's own list, a decorator's, a fragment's. */\nfunction paramOwner(param: AstNode): string {\n const owner = param.$container?.$container;\n if (isFnDecl(owner)) return \"Parameter of this `fn`.\";\n if (isFnExpr(owner)) return \"Parameter of this function — typed by where it is called.\";\n if (isDecoDecl(owner)) return decoParam(param);\n return \"Fragment parameter.\";\n}\n\n/** A `deco`'s first parameter is the thing decorated; the rest are its arguments. */\nfunction decoParam(param: AstNode): string {\n const list = param.$container as ParamList | undefined;\n if (list?.params[0] !== param) return \"Argument of this decorator, filled by `@name(…)`.\";\n return \"What this decorator decorates — its type is the kind it may be written on.\";\n}\n\nfunction describe(binding: AstNode): string | undefined {\n if (isForEachStmt(binding)) return \"Loop variable of `forEach`.\";\n if (isRepeatStmt(binding)) return \"Loop index of `repeat`.\";\n if (isParam(binding)) return paramOwner(binding);\n return undefined;\n}\n","import { isDecoDecl, isFragmentDecl } from \"@venn-lang/core\";\nimport { UriUtils } from \"langium\";\nimport { declaredDeco, decoHover } from \"../deco/index.js\";\nimport type { ImportedLocation } from \"../document/index.js\";\nimport { code, fence, rule } from \"../markdown/index.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport { declarationHover, fragmentHover } from \"./render-decl.js\";\n\nexport interface ImportedHoverArgs {\n location: ImportedLocation;\n name: string;\n types: TypeService;\n}\n\n/**\n * A name as it reads inside `import { … }`.\n *\n * Whatever the other file declared, described the way that file would describe\n * it, so importing a name and standing on its declaration read alike. The\n * import list is the one place a name is neither a declaration nor a use, so\n * nothing else in the hover reaches it.\n */\nexport function importedHover(args: ImportedHoverArgs): string | undefined {\n const { location, name } = args;\n const { decl, document } = location;\n if (!decl || !document) return unread(location, name);\n if (isFragmentDecl(decl)) return fragmentHover({ ...location, decl, document });\n if (isDecoDecl(decl)) return decoHover(declaredDeco({ decl, document }));\n return declarationHover({ document, node: decl, types: args.types });\n}\n\n/** The file could not be read, or declares no such name; say what is known. */\nfunction unread(location: ImportedLocation, name: string): string {\n return rule([fence(name), `Imported from ${code(UriUtils.basename(location.uri))}.`]);\n}\n\n/**\n * The specifier itself: where `\"#shared/auth.vn\"` actually lands.\n *\n * An alias is the one specifier a reader cannot resolve in their head: it goes\n * through `[paths]` in `venn.toml`, which is a different file. Saying the\n * resolved path is the whole answer.\n */\nexport function importPathHover(args: { location: ImportedLocation; path: string }): string {\n const { location, path } = args;\n const file = code(UriUtils.basename(location.uri));\n const read = location.document ? `Resolves to ${file}.` : `Resolves to ${file} — not readable.`;\n return rule([fence(`from \"${path}\"`), read]);\n}\n","import { BUILTIN_TYPES, KIND_SPECS, TARGET_KINDS } from \"@venn-lang/core\";\nimport type { RecordSpec, TypeSpec } from \"@venn-lang/types\";\nimport { showSpec } from \"@venn-lang/types\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { code, fence, labelled, rule, sections } from \"../markdown/index.js\";\n\n/** What each decorator handle is a handle *on*, in the user's words. */\nconst DECORATES: Readonly<Record<string, string>> = {\n Fn: \"a `fn` — its parameters, and what happens around a call to it\",\n Flow: \"a `flow` — its title, and what happens around its body\",\n Step: \"a `step` — its title, and what happens around its body\",\n Binding: \"a `let` or `const` — the value it holds\",\n Type: \"a `type` — the fields it declares\",\n Resource: \"a `resource` — its name and its metadata\",\n Node: \"any declaration at all, by name\",\n};\n\n/**\n * Hover for a type written in an annotation: `target: Fn`, `x: string`.\n *\n * A type name is where the reader most needs telling. Unanswered, `Fn` looks\n * like a name someone made up rather than the surface the body is about to use.\n */\nexport function typeNameHover(name: string, catalog: SymbolCatalog): string | undefined {\n return builtinHover(name) ?? kindHover(name) ?? publishedHover(name, catalog);\n}\n\n/** One of the language's own types: `string`, `duration`, `dynamic`. */\nfunction builtinHover(name: string): string | undefined {\n const builtin = BUILTIN_TYPES[name];\n if (!builtin) return undefined;\n return rule([\n fence(name),\n sections([builtin.doc, labelled(\"Written\", fence(builtin.example))]),\n \"**Built in** — part of the language, no `use` needed.\",\n ]);\n}\n\n/** One of the seven decorator handles. */\nfunction kindHover(name: string): string | undefined {\n if (!TARGET_KINDS.includes(name as (typeof TARGET_KINDS)[number])) return undefined;\n const spec = KIND_SPECS[name as keyof typeof KIND_SPECS];\n return rule([\n fence(`${name} — a decorator target`),\n sections([\n `Written as a \\`deco\\`'s first parameter, it decorates ${DECORATES[name] ?? \"a declaration\"}.`,\n membersBlock(spec),\n ]),\n \"The body runs at expansion time, before the program exists.\",\n ]);\n}\n\n/** A type a plugin published: `http.Response`, `db.Row`. */\nfunction publishedHover(name: string, catalog: SymbolCatalog): string | undefined {\n const dot = name.indexOf(\".\");\n if (dot < 0) return undefined;\n const found = catalog\n .typesIn(name.slice(0, dot))\n .find((entry) => entry.name === name.slice(dot + 1));\n if (!found) return undefined;\n return rule([\n fence(`${found.namespace}.${found.name}`),\n membersBlock(found.spec),\n `**Package** ${code(found.package)}`,\n ]);\n}\n\n/**\n * One line per member, rather than one line for all of them. A handle carries\n * ten verbs, and rendered end to end they run past the edge of any hover.\n */\nfunction membersBlock(spec: TypeSpec): string | undefined {\n if (spec.kind !== \"record\") return undefined;\n const fields = Object.entries((spec as RecordSpec).fields);\n if (fields.length === 0) return undefined;\n const lines = fields.map(([field, type]) => `- ${code(field)}: ${code(showSpec(type))}`);\n return labelled(\"Offers\", lines.join(\"\\n\"));\n}\n","import { type AstNode, createContext, isPrelude, resolveMember, type Type } from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { findBinding } from \"../document/index.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport { actionHover } from \"./render-action.js\";\nimport { bindingHover } from \"./render-decl.js\";\nimport { memberHover, namespaceHover, preludeHover } from \"./render-symbol.js\";\n\nexport interface ResolveArgs {\n /** The dotted path under the cursor, e.g. `people.maxBy`. */\n path: string;\n /** Which segment the cursor sits on; `0` is the head. */\n segment: number;\n /** A node inside the file, for looking a name up in scope. */\n host: AstNode;\n document: LangiumDocument;\n catalog: SymbolCatalog;\n types: TypeService;\n}\n\n/**\n * Describe what a dotted path refers to, wherever it is written: a prelude verb,\n * a plugin namespace or one of its actions, a built-in member of a value, or a\n * binding the file declared.\n *\n * It resolves from the path's text rather than from parsed nodes, because an\n * expression inside `\"${…}\"` is parsed apart from the document. That way the\n * same name reads the same in both places.\n */\nexport function resolveSymbol(args: ResolveArgs): string | undefined {\n const segments = args.path.split(\".\");\n const head = segments[0];\n if (!head) return undefined;\n const binding = findBinding(args.host, head);\n if (args.segment === 0) return headHover({ head, binding, args });\n if (!binding && args.catalog.hasNamespace(head)) return actionHover(args.path, args.catalog);\n return memberOf({ segments, binding, args });\n}\n\n/** The first segment: something the file bound, a namespace, or a prelude name. */\nfunction headHover(input: {\n head: string;\n binding: AstNode | undefined;\n args: ResolveArgs;\n}): string | undefined {\n const { head, binding, args } = input;\n if (binding) {\n return bindingHover({\n document: args.document,\n node: args.host,\n name: head,\n types: args.types,\n });\n }\n return namespaceHover(head, args.catalog) ?? (isPrelude(head) ? preludeHover(head) : undefined);\n}\n\n/** `xs.map`, `cfg.server.port`: walk to the receiver, then describe its member. */\nfunction memberOf(input: {\n segments: readonly string[];\n binding: AstNode | undefined;\n args: ResolveArgs;\n}): string | undefined {\n const { segments, binding, args } = input;\n const member = segments[args.segment];\n let receiver = binding && args.types.of(args.document).types.get(binding);\n if (!receiver || !member) return undefined;\n for (const step of segments.slice(1, args.segment)) {\n const next = resolveMember(receiver, step, createContext());\n if (!next) return undefined;\n receiver = next;\n }\n return memberHover({ receiver, member });\n}\n\nexport type { Type };\n","import {\n type ActionCall,\n type AstNode,\n type Document,\n isActionCall,\n isAnnotation,\n isDecoDecl,\n isFnDecl,\n isFragmentDecl,\n isMatcherClause,\n isMember,\n isNamedType,\n isRunStmt,\n isUseDecl,\n isValueImport,\n type ValueImport,\n} from \"@venn-lang/core\";\nimport {\n type CstNode,\n CstUtils,\n GrammarUtils,\n type LangiumDocument,\n type LangiumDocuments,\n} from \"langium\";\nimport type { HoverProvider } from \"langium/lsp\";\nimport { type Hover, type HoverParams, MarkupKind } from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { declaredDeco, decoHover, decoNamed, documentedHover } from \"../deco/index.js\";\nimport {\n findBinding,\n hostAt,\n interpolationAt,\n pathOf,\n resolveFragment,\n resolveImported,\n} from \"../document/index.js\";\nimport { waitingFns } from \"../effects/index.js\";\nimport { envHover, envVars } from \"../env/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\nimport { keywordHover } from \"./keywords.js\";\nimport { actionHover, matcherHover } from \"./render-action.js\";\nimport { declarationHover, fragmentHover, useHover } from \"./render-decl.js\";\nimport { importedHover, importPathHover } from \"./render-imported.js\";\nimport { memberHover } from \"./render-symbol.js\";\nimport { typeNameHover } from \"./render-type-name.js\";\nimport { resolveSymbol } from \"./resolve-symbol.js\";\nimport { inferredType } from \"./type-hover.js\";\n\n/**\n * Rich markdown hover: actions, matchers, fragments, bindings and keywords.\n *\n * Which token the cursor sits on decides the answer, so every branch checks the\n * CST property it belongs to rather than the enclosing node alone.\n */\nexport class VennHoverProvider implements HoverProvider {\n private readonly catalog: SymbolCatalog;\n private readonly documents: LangiumDocuments;\n private readonly imports: ImportResolver;\n private readonly types: TypeService;\n\n constructor(services: VennServices) {\n this.catalog = services.catalog;\n this.documents = services.shared.workspace.LangiumDocuments;\n this.imports = services.imports;\n this.types = services.types;\n }\n\n async getHoverContent(\n document: LangiumDocument,\n params: HoverParams,\n ): Promise<Hover | undefined> {\n const offset = document.textDocument.offsetAt(params.position);\n const leaf = leafAt(document, offset);\n const value =\n this.inString(document, offset) ??\n (leaf && (await this.describe(leaf, document))) ??\n (leaf ? inferredType(leaf, this.types) : undefined);\n return value ? { contents: { kind: MarkupKind.Markdown, value } } : undefined;\n }\n\n /** Inside `\"${…}\"` the name is code, so it hovers like code, not like text. */\n private inString(document: LangiumDocument, offset: number): string | undefined {\n const hit = interpolationAt({ document, offset });\n if (!hit) return undefined;\n if (hit.path.startsWith(\"env.\")) {\n // `env` the namespace explains itself; `env.NAME` describes the variable.\n return hit.isHead ? keywordHover(\"env\") : this.envVar(hit.name, document);\n }\n // Resolve against the parsed expression when there is one: a name bound\n // inside the placeholder, such as a lambda parameter, lives only there.\n const host = hostAt({ document, offset, types: this.types.of(document) }) ?? hit.host;\n return (\n this.member(host, hit.name, document) ??\n this.resolve({ path: hit.path, segment: hit.segment, host, document })\n );\n }\n\n /**\n * A member read off the node rather than off the text.\n *\n * The dotted-path resolver can only name a chain of identifiers, so it has\n * nothing to say about `(1234.567).round` or `f(x).len`. The receiver's\n * inferred type is right there on the tree, so read it from there instead.\n */\n private member(node: AstNode, name: string, document: LangiumDocument): string | undefined {\n if (!isMember(node) || node.member !== name) return undefined;\n const receiver = this.types.of(document).types.get(node.receiver);\n return receiver ? memberHover({ receiver, member: name }) : undefined;\n }\n\n /** The one resolver every place uses, so a name reads the same anywhere. */\n private resolve(args: {\n path: string;\n segment: number;\n host: AstNode;\n document: LangiumDocument;\n }): string | undefined {\n return resolveSymbol({ ...args, catalog: this.catalog, types: this.types });\n }\n\n /** Which of this file's functions wait for something, for the signature to say so. */\n private waits(document: LangiumDocument): ReadonlySet<string> {\n const root = document.parseResult?.value as Document | undefined;\n return root ? waitingFns(root, this.catalog) : new Set();\n }\n\n /** `env.NAME` is not a variable anyone declared here; `venn.toml` declares it. */\n private envVar(name: string, document: LangiumDocument): string | undefined {\n const found = envVars(this.imports.env(document.uri), this.imports.envDocs(document.uri)).find(\n (variable) => variable.name === name,\n );\n return found && envHover(found);\n }\n\n private async describe(leaf: CstNode, document: LangiumDocument): Promise<string | undefined> {\n return (await this.symbol(leaf, document)) ?? keywordHover(leaf.text);\n }\n\n // Which token the cursor sits on decides this: `run login()` is a keyword on\n // `run` and a fragment on `login`.\n private async symbol(leaf: CstNode, document: LangiumDocument): Promise<string | undefined> {\n const node = leaf.astNode;\n if (isAnnotation(node)) return this.decorator(node.name, document);\n const env = envPath(node);\n if (env) return this.envVar(env, document);\n if (isValueImport(node)) return this.imported(node, leaf, document);\n const symbol = this.pathHover(node, document);\n if (symbol) return symbol;\n const member = this.member(node, leaf.text, document);\n if (member) return member;\n if (isActionCall(node) && on(leaf, node, \"target\"))\n return this.callTarget(node, leaf, document);\n if (isNamedType(node)) return typeNameHover(node.name, this.catalog);\n if (isMatcherClause(node) && on(leaf, node, \"name\"))\n return matcherHover(node.name, this.catalog);\n if (isUseDecl(node) && on(leaf, node, \"pkg\")) return useHover(node, this.catalog);\n return this.declared(leaf, node, document);\n }\n\n /**\n * A name in an `import` list, or the specifier it comes from.\n *\n * The list is the one place a name is neither declared nor used, so no other\n * branch reaches it. It is also where a reader is deciding whether they want\n * the thing at all, which is where a hover is worth the most.\n */\n private async imported(\n node: ValueImport,\n leaf: CstNode,\n document: LangiumDocument,\n ): Promise<string | undefined> {\n const name = importedName(node, leaf.text);\n const location = await resolveImported({\n name: name ?? \"\",\n decl: node,\n document,\n documents: this.documents,\n imports: this.imports,\n });\n if (name) return importedHover({ location, name, types: this.types });\n // The specifier, and `helpers` in `import * as helpers`, which names the\n // whole file rather than anything inside it, so the file is the answer.\n if (!on(leaf, node, \"path\") && leaf.text !== node.wildcard) return undefined;\n return importPathHover({ location, path: node.path });\n }\n\n /**\n * The verb of a call written as a statement.\n *\n * Usually a plugin's, as in `http.get`. But `target.wrap(…)` is a method on a\n * value, and the parser reads it as a call whose target is text, so the\n * member chain a hover normally walks does not exist. Resolving from that\n * text puts it back, which is why hovering `target` inside a `deco` answers.\n */\n private callTarget(\n node: ActionCall,\n leaf: CstNode,\n document: LangiumDocument,\n ): string | undefined {\n const head = node.target.split(\".\")[0];\n if (head && findBinding(node, head)) {\n return this.resolve({\n path: node.target,\n segment: dotsBefore(node, leaf),\n host: node,\n document,\n });\n }\n return actionHover(node.target, this.catalog);\n }\n\n /**\n * A dotted path written plainly: `fmt.json`, `xs.map`, `range`. The segment\n * under the cursor decides what is described: the namespace, or its verb.\n */\n private pathHover(node: AstNode, document: LangiumDocument): string | undefined {\n const path = pathOf(outermost(node));\n if (!path) return undefined;\n return this.resolve({ path, segment: segmentAt(node), host: node, document });\n }\n\n private async declared(\n leaf: CstNode,\n node: AstNode,\n document: LangiumDocument,\n ): Promise<string | undefined> {\n if (isRunStmt(node) && on(leaf, node, \"target\")) return this.fragment(node.target, document);\n if (isFnDecl(node) && on(leaf, node, \"name\"))\n return declarationHover({ document, node, types: this.types, waiting: this.waits(document) });\n if (isFragmentDecl(node) && on(leaf, node, \"name\")) return this.fragment(node.name, document);\n if (isDecoDecl(node) && on(leaf, node, \"name\")) {\n return decoHover(declaredDeco({ decl: node, document }));\n }\n if (!on(leaf, node, \"name\")) return undefined;\n return declarationHover({ document, node, types: this.types, waiting: this.waits(document) });\n }\n\n /**\n * `@name`: whatever defines it. A `deco` this file declares or imported, or\n * a built-in; either way the same text a hover on the `deco` itself gives.\n */\n private async decorator(name: string, document: LangiumDocument): Promise<string | undefined> {\n const scope = { document, documents: this.documents, imports: this.imports };\n const found = await decoNamed(name, scope);\n return found ? decoHover(found) : documentedHover(name);\n }\n\n private async fragment(name: string, document: LangiumDocument): Promise<string | undefined> {\n const location = await resolveFragment({\n name,\n document,\n documents: this.documents,\n imports: this.imports,\n });\n return location && fragmentHover(location);\n }\n}\n\n/**\n * Which name of an import the cursor is on, if any.\n *\n * `import { a, b }` names two things and `import x from` names one, but both\n * are one node carrying plain strings, so the word under the cursor is the\n * only thing that says which was meant.\n */\nfunction importedName(node: ValueImport, text: string): string | undefined {\n if (node.names.includes(text)) return text;\n return node.default === text ? text : undefined;\n}\n\n/** True when the cursor's token lies inside the CST range of that property. */\nfunction on(leaf: CstNode, node: AstNode, property: string): boolean {\n const cst = GrammarUtils.findNodeForProperty(node.$cstNode, property);\n return Boolean(cst && leaf.offset >= cst.offset && leaf.offset < cst.offset + cst.length);\n}\n\nfunction leafAt(document: LangiumDocument, offset: number): CstNode | undefined {\n const root = document.parseResult?.value?.$cstNode;\n return root ? CstUtils.findLeafNodeAtOffset(root, offset) : undefined;\n}\n\n/** The variable name in `env.NAME`, when that is what the cursor is on. */\nfunction envPath(node: AstNode): string | undefined {\n const path = pathOf(node);\n return path?.startsWith(\"env.\") && !path.slice(4).includes(\".\") ? path.slice(4) : undefined;\n}\n\n/** Climb to the end of a member chain: from `fmt` in `fmt.json`, to `fmt.json`. */\nfunction outermost(node: AstNode): AstNode {\n let current = node;\n while (isMember(current.$container) && current.$container.receiver === current) {\n current = current.$container;\n }\n return current;\n}\n\n/**\n * The same count for a call whose target is text rather than a chain: the dots\n * standing between the start of `target.wrap` and the token under the cursor.\n */\nfunction dotsBefore(node: ActionCall, leaf: CstNode): number {\n const start = node.$cstNode?.offset ?? 0;\n const upTo = node.target.slice(0, Math.max(0, leaf.offset - start));\n return upTo.split(\".\").length - 1;\n}\n\n/**\n * How many dots separate the chain's head from the token under the cursor. The\n * cursor's own node is the innermost one that reaches it, so its depth in the\n * chain is the answer: `a` is 0, `a.b` is 1, `a.b.c` is 2.\n */\nfunction segmentAt(node: AstNode): number {\n let depth = 0;\n let current: AstNode = node;\n while (isMember(current)) {\n depth += 1;\n current = current.receiver;\n }\n return depth;\n}\n","import { GrammarUtils } from \"langium\";\nimport type { Range } from \"vscode-languageserver\";\nimport type { Occurrence } from \"./symbol.types.js\";\n\n/** Where an occurrence sits in the text, or nothing when the CST has no node. */\nexport function rangeOf(occurrence: Occurrence): Range | undefined {\n const cst = GrammarUtils.findNodeForProperty(\n occurrence.node.$cstNode,\n occurrence.property,\n occurrence.index,\n );\n return cst?.range;\n}\n\n/** The occurrences that resolved to a real range, as ranges. */\nexport function rangesOf(occurrences: readonly Occurrence[]): Range[] {\n const found: Range[] = [];\n for (const each of occurrences) {\n const range = rangeOf(each);\n if (range) found.push(range);\n }\n return found;\n}\n","import { type AstNode, isForEachStmt, isRepeatStmt } from \"@venn-lang/core\";\n\n/**\n * Which property of a declaration carries the name it binds.\n *\n * Most spell it `name`; a `forEach` calls its variable `item` and a `repeat`\n * calls its counter `index`. Kept in one place because every reader of a\n * declaration needs the answer, and copies of it drift.\n */\nexport function nameProperty(node: AstNode | object): string | undefined {\n if (isForEachStmt(node)) return \"item\";\n if (isRepeatStmt(node)) return \"index\";\n return \"name\" in node ? \"name\" : undefined;\n}\n","import {\n type AstNode,\n type Document,\n isAnnotation,\n isDecoDecl,\n isFnDecl,\n isFragmentDecl,\n isNamedType,\n isRef,\n isRunStmt,\n isTypeDecl,\n isValueImport,\n walkAst,\n} from \"@venn-lang/core\";\nimport { findBinding } from \"../document/index.js\";\nimport { nameProperty } from \"./name-property.js\";\nimport type { FoundSymbol, Occurrence } from \"./symbol.types.js\";\n\n/**\n * Every place one symbol appears in one document.\n *\n * One walk, one answer, whatever the caller wants it for: \"find all references\"\n * shows them, the editor highlights them, and rename rewrites them. Three\n * separate readings of the tree would be three chances to disagree.\n */\nexport function occurrencesIn(args: { root: Document; symbol: FoundSymbol }): Occurrence[] {\n const found = importNames(args.root, args.symbol.name);\n for (const node of walkAst(args.root)) {\n const one = occurrenceAt({ node, symbol: args.symbol });\n if (one) found.push(one);\n }\n return found;\n}\n\nfunction occurrenceAt(args: { node: AstNode; symbol: FoundSymbol }): Occurrence | undefined {\n const { node, symbol } = args;\n if (symbol.kind === \"binding\") return bindingUse(node, symbol);\n if (symbol.kind === \"type\") return typeUse(node, symbol.name);\n if (symbol.kind === \"deco\") return decoUse(node, symbol.name);\n if (symbol.kind === \"fragment\") return fragmentUse(node, symbol.name);\n if (symbol.kind === \"fn\") return fnUse(node, symbol.name);\n return externalUse(node, symbol.name);\n}\n\n/**\n * A name this file imported: found wherever a name of any importable kind can\n * appear.\n *\n * Which of the three it is (fragment, function or decorator) is written in the\n * file it came from, and this is asked of every file in the workspace, one of\n * which is that one. Matching all three shapes reaches it without reading\n * ahead, and no shape can match a name that is not this one.\n */\nfunction externalUse(node: AstNode, name: string): Occurrence | undefined {\n return fnUse(node, name) ?? fragmentUse(node, name) ?? decoUse(node, name);\n}\n\n/** `import { a, b }`: one node holding several names, so each is found by index. */\nfunction importNames(root: Document, name: string): Occurrence[] {\n const found: Occurrence[] = [];\n for (const decl of root.imports) {\n if (!isValueImport(decl)) continue;\n decl.names.forEach((each, index) => {\n if (each === name) found.push({ node: decl, property: \"names\", index, declaration: false });\n });\n }\n return found;\n}\n\nfunction fragmentUse(node: AstNode, name: string): Occurrence | undefined {\n if (isFragmentDecl(node) && node.name === name) return declaration(node);\n if (isRunStmt(node) && node.target === name) {\n return { node, property: \"target\", declaration: false };\n }\n return undefined;\n}\n\nfunction decoUse(node: AstNode, name: string): Occurrence | undefined {\n if (isDecoDecl(node) && node.name === name) return declaration(node);\n if (isAnnotation(node) && node.name === name) {\n return { node, property: \"name\", declaration: false };\n }\n return undefined;\n}\n\n/**\n * A function: where it is declared, and every name that reads it.\n *\n * Matched by name rather than by resolving each reference back to the\n * declaration, because a `pub fn` is read in files that never declared it: the\n * file next door holds the same name and means the same thing.\n */\nfunction fnUse(node: AstNode, name: string): Occurrence | undefined {\n if (isFnDecl(node) && node.name === name) return declaration(node);\n if (isRef(node) && node.name === name) return { node, property: \"name\", declaration: false };\n return undefined;\n}\n\nfunction typeUse(node: AstNode, name: string): Occurrence | undefined {\n if (isTypeDecl(node) && node.name === name) return declaration(node);\n if (isNamedType(node) && node.name === name) {\n return { node, property: \"name\", declaration: false };\n }\n return undefined;\n}\n\n/**\n * A binding, and only the reads that resolve back to this one.\n *\n * A name shadowed in an inner block is a different binding wearing the same\n * spelling, and reporting it would send the reader to a line that has nothing\n * to do with what they asked about.\n */\nfunction bindingUse(node: AstNode, symbol: FoundSymbol): Occurrence | undefined {\n if (node === symbol.binding) return declaration(node);\n if (!isRef(node) || node.name !== symbol.name) return undefined;\n if (findBinding(node, symbol.name) !== symbol.binding) return undefined;\n return { node, property: \"name\", declaration: false };\n}\n\nfunction declaration(node: AstNode): Occurrence | undefined {\n const property = nameProperty(node);\n return property ? { node, property, declaration: true } : undefined;\n}\n","import {\n type AstNode,\n isAnnotation,\n isCaptureStmt,\n isDatasetDecl,\n isDecoDecl,\n isDocument,\n isFnDecl,\n isForEachStmt,\n isFragmentDecl,\n isLetStmt,\n isNamedType,\n isParam,\n isRef,\n isRepeatStmt,\n isRunStmt,\n isTypeDecl,\n isValueImport,\n} from \"@venn-lang/core\";\nimport { AstUtils, type CstNode, CstUtils, type LangiumDocument } from \"langium\";\nimport type { Position } from \"vscode-languageserver\";\nimport { findBinding } from \"../document/index.js\";\nimport { nameProperty } from \"./name-property.js\";\nimport type { FoundSymbol } from \"./symbol.types.js\";\n\n/**\n * The symbol a position names, or nothing when it names none.\n *\n * Read from the token under the cursor rather than from the node containing it:\n * one node often carries two names (`import { a, b }` is a single node, and so\n * is `run login(\"x\")`), and the answer depends on which word was clicked.\n */\nexport function symbolAt(document: LangiumDocument, position: Position): FoundSymbol | undefined {\n const leaf = leafAt(document, position);\n if (!leaf) return undefined;\n return declared(leaf) ?? used(leaf);\n}\n\nexport function leafAt(document: LangiumDocument, position: Position): CstNode | undefined {\n const root = document.parseResult?.value?.$cstNode;\n const offset = document.textDocument.offsetAt(position);\n return root ? CstUtils.findLeafNodeAtOffset(root, offset) : undefined;\n}\n\n/** The cursor is on the word that introduces the name. */\nfunction declared(leaf: CstNode): FoundSymbol | undefined {\n const node = leaf.astNode;\n const name = leaf.text;\n if (isFragmentDecl(node) && node.name === name) return { kind: \"fragment\", name };\n if (isDecoDecl(node) && node.name === name) return { kind: \"deco\", name };\n if (isFnDecl(node) && node.name === name) return { kind: \"fn\", name };\n if (isTypeDecl(node) && node.name === name) return { kind: \"type\", name, binding: node };\n return declaredBinding(leaf);\n}\n\n/**\n * The cursor on the word a `const`, a parameter or a loop variable introduces.\n *\n * Told apart from a use by the node it sits on, never by the text. A `Ref` also\n * carries a `name` equal to the word under the cursor, and treating one as a\n * declaration would make the binding be itself, so no read of it would resolve.\n */\nfunction declaredBinding(leaf: CstNode): FoundSymbol | undefined {\n const node = leaf.astNode;\n if (!binds(node)) return undefined;\n const property = nameProperty(node);\n const written = property && (node as unknown as Record<string, unknown>)[property];\n return written === leaf.text ? { kind: \"binding\", name: leaf.text, binding: node } : undefined;\n}\n\nfunction binds(node: AstNode): boolean {\n return (\n isLetStmt(node) ||\n isCaptureStmt(node) ||\n isDatasetDecl(node) ||\n isParam(node) ||\n isForEachStmt(node) ||\n isRepeatStmt(node)\n );\n}\n\n/** The cursor is on a use of the name, or on one inside an `import { … }`. */\nfunction used(leaf: CstNode): FoundSymbol | undefined {\n const node = leaf.astNode;\n const name = leaf.text;\n if (isRunStmt(node) && node.target === name) return { kind: \"fragment\", name };\n if (isAnnotation(node) && node.name === name) return { kind: \"deco\", name };\n if (isNamedType(node) && node.name === name) return { kind: \"type\", name };\n if (isValueImport(node) && node.names.includes(name)) return { kind: \"external\", name };\n return isRef(node) && node.name === name ? boundSymbol(node, name) : undefined;\n}\n\n/**\n * A plain name: which binding it resolves to decides how far it reaches.\n *\n * A `fn` this file declared is importable, so its uses may be anywhere; a\n * `const` or a parameter is bound here and a name spelled the same next door is\n * a different name entirely.\n */\nfunction boundSymbol(node: AstNode, name: string): FoundSymbol {\n const binding = findBinding(node, name);\n if (binding && isFnDecl(binding)) return { kind: \"fn\", name };\n if (binding && isFragmentDecl(binding)) return { kind: \"fragment\", name };\n if (binding && isDecoDecl(binding)) return { kind: \"deco\", name };\n // Nothing here binds it and the file imported it, so it belongs to another\n // file. Calling it a local binding would keep the search inside this one.\n if (!binding && isImported(node, name)) return { kind: \"external\", name };\n return { kind: \"binding\", name, binding };\n}\n\nfunction isImported(from: AstNode, name: string): boolean {\n const root = AstUtils.getContainerOfType(from, isDocument);\n return (root?.imports ?? []).some((decl) => isValueImport(decl) && decl.names.includes(name));\n}\n","import type { Document } from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { DocumentHighlightProvider } from \"langium/lsp\";\nimport {\n type DocumentHighlight,\n DocumentHighlightKind,\n type DocumentHighlightParams,\n} from \"vscode-languageserver\";\nimport { rangeOf } from \"./occurrence-range.js\";\nimport { occurrencesIn } from \"./occurrences.js\";\nimport type { Occurrence } from \"./symbol.types.js\";\nimport { symbolAt } from \"./symbol-at.js\";\n\n/**\n * The other places the name under the cursor appears, marked in this file.\n *\n * Only this file, whatever the symbol's reach: highlighting is about the page\n * being read. Where the name is introduced is drawn apart from where it is\n * used, which is the quickest way to see that a value is written once and read\n * four times, or written twice, which is usually the bug being looked for.\n */\nexport class VennDocumentHighlightProvider implements DocumentHighlightProvider {\n getDocumentHighlight(\n document: LangiumDocument,\n params: DocumentHighlightParams,\n ): DocumentHighlight[] {\n const symbol = symbolAt(document, params.position);\n const root = document.parseResult?.value as Document | undefined;\n if (!symbol || !root) return [];\n return marked(occurrencesIn({ root, symbol }));\n }\n}\n\nfunction marked(occurrences: readonly Occurrence[]): DocumentHighlight[] {\n const found: DocumentHighlight[] = [];\n for (const each of occurrences) {\n const range = rangeOf(each);\n if (range) found.push({ range, kind: kindOf(each) });\n }\n return found;\n}\n\nfunction kindOf(occurrence: Occurrence): DocumentHighlightKind {\n return occurrence.declaration ? DocumentHighlightKind.Write : DocumentHighlightKind.Read;\n}\n","import type { AstNode } from \"@venn-lang/core\";\n\n/**\n * What a name under the cursor turns out to be.\n *\n * The kinds differ in one thing that decides everything downstream: how far the\n * name reaches. A `fragment`, a `deco` and a `pub fn` cross files, so finding\n * every use means reading the workspace. A `const`, a parameter or a loop\n * variable is bound in one place in one file, and a name spelled the same\n * anywhere else is a different name: following it out of the file would report\n * strangers as references.\n */\nexport type SymbolKind = \"fragment\" | \"deco\" | \"fn\" | \"type\" | \"binding\" | \"external\";\n\nexport interface FoundSymbol {\n kind: SymbolKind;\n name: string;\n /**\n * The node that binds it, when the kind is file-scoped. Two `const`s of the\n * same name in one file are two symbols, and this is what tells them apart.\n */\n binding?: AstNode;\n}\n\n/** One place a name appears, named by the property of the node that holds it. */\nexport interface Occurrence {\n node: AstNode;\n property: string;\n /** For a list-valued property: the names inside `import { a, b }`. */\n index?: number;\n /** Whether this is where the name is introduced, rather than used. */\n declaration: boolean;\n}\n\n/** Whether a symbol's uses can be in another file at all. */\nexport function crossesFiles(kind: SymbolKind): boolean {\n return kind !== \"binding\" && kind !== \"type\";\n}\n","import type { Document } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments } from \"langium\";\nimport type { Location, Range } from \"vscode-languageserver\";\nimport { rangesOf } from \"./occurrence-range.js\";\nimport { occurrencesIn } from \"./occurrences.js\";\nimport { crossesFiles, type FoundSymbol, type Occurrence } from \"./symbol.types.js\";\n\n/** One document's share of the answer. */\nexport interface FoundIn {\n uri: string;\n occurrences: readonly Occurrence[];\n}\n\n/**\n * Every place a symbol appears, in the file that asked and in the workspace\n * when the symbol reaches that far.\n *\n * A file-scoped binding is never searched for elsewhere. That is not an\n * optimisation: a `const` named `user` next door is a different `user`, and\n * offering it as a reference sends the reader somewhere unrelated.\n */\nexport function findOccurrences(args: {\n symbol: FoundSymbol;\n document: LangiumDocument;\n documents: LangiumDocuments;\n}): FoundIn[] {\n const here = inDocument(args.document, args.symbol);\n if (!crossesFiles(args.symbol.kind)) return here ? [here] : [];\n const found: FoundIn[] = [];\n for (const document of args.documents.all) {\n const one = inDocument(document, args.symbol);\n if (one) found.push(one);\n }\n return found;\n}\n\nfunction inDocument(document: LangiumDocument, symbol: FoundSymbol): FoundIn | undefined {\n const root = document.parseResult?.value as Document | undefined;\n if (!root) return undefined;\n const occurrences = occurrencesIn({ root, symbol });\n return occurrences.length > 0 ? { uri: document.uri.toString(), occurrences } : undefined;\n}\n\n/** The same answer as locations, which is the shape the editor asks for. */\nexport function locationsOf(found: readonly FoundIn[]): Location[] {\n return found.flatMap((one) =>\n rangesOf(one.occurrences).map((range: Range) => ({ uri: one.uri, range })),\n );\n}\n","import type { LangiumDocument, LangiumDocuments } from \"langium\";\nimport type { ReferencesProvider } from \"langium/lsp\";\nimport type { Location, ReferenceParams } from \"vscode-languageserver\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport { findOccurrences, locationsOf } from \"./find-occurrences.js\";\nimport { symbolAt } from \"./symbol-at.js\";\n\n/**\n * Shift+F12: every place a name is used.\n *\n * Langium's own provider resolves cross-references the grammar declares, and\n * this grammar declares none: a `run` target is a string, a `@name` is a string,\n * and which `const` a `Ref` means is worked out by walking scopes. So the answer\n * has to be worked out the same way the checker and the evaluator work it out,\n * which is what this shares with them.\n */\nexport class VennReferencesProvider implements ReferencesProvider {\n private readonly documents: LangiumDocuments;\n\n constructor(services: VennServices) {\n this.documents = services.shared.workspace.LangiumDocuments;\n }\n\n findReferences(document: LangiumDocument, params: ReferenceParams): Location[] {\n const symbol = symbolAt(document, params.position);\n if (!symbol) return [];\n const found = findOccurrences({ symbol, document, documents: this.documents });\n const wanted = params.context?.includeDeclaration === false ? uses(found) : found;\n return locationsOf(wanted);\n }\n}\n\n/** The editor may ask for the uses without the line that introduces the name. */\nfunction uses(found: ReturnType<typeof findOccurrences>): ReturnType<typeof findOccurrences> {\n return found\n .map((one) => ({ ...one, occurrences: one.occurrences.filter((each) => !each.declaration) }))\n .filter((one) => one.occurrences.length > 0);\n}\n","import { type Document, isDecoDecl } from \"@venn-lang/core\";\nimport type { LangiumDocument, LangiumDocuments } from \"langium\";\n\n/** Whether any open document declares a `deco` by this name. */\nexport function declaresDeco(documents: LangiumDocuments, name: string): boolean {\n for (const document of documents.all) {\n const decls = rootOf(document)?.decls ?? [];\n if (decls.some((decl) => isDecoDecl(decl) && decl.name === name)) return true;\n }\n return false;\n}\n\nfunction rootOf(document: LangiumDocument): Document | undefined {\n return document.parseResult?.value as Document | undefined;\n}\n","import type { LangiumDocument, LangiumDocuments } from \"langium\";\nimport type { RenameProvider } from \"langium/lsp\";\nimport type {\n PrepareRenameParams,\n Range,\n RenameParams,\n TextEdit,\n WorkspaceEdit,\n} from \"vscode-languageserver\";\nimport {\n type FoundSymbol,\n findOccurrences,\n leafAt,\n type Occurrence,\n rangeOf,\n symbolAt,\n} from \"../references/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport { declaresDeco } from \"./declares-deco.js\";\n\n/**\n * F2: rename a name wherever it means this one.\n *\n * Reads the same occurrences \"find all references\" reports, so the two cannot\n * disagree. A rename that silently misses a use is worse than no rename at all.\n */\nexport class VennRenameProvider implements RenameProvider {\n private readonly documents: LangiumDocuments;\n\n constructor(services: VennServices) {\n this.documents = services.shared.workspace.LangiumDocuments;\n }\n\n rename(document: LangiumDocument, params: RenameParams): WorkspaceEdit | undefined {\n const symbol = this.wanted(document, params);\n if (!symbol) return undefined;\n const changes: Record<string, TextEdit[]> = {};\n for (const found of findOccurrences({ symbol, document, documents: this.documents })) {\n const edits = rewrites(found.occurrences, params.newName);\n if (edits.length > 0) changes[found.uri] = edits;\n }\n return Object.keys(changes).length > 0 ? { changes } : undefined;\n }\n\n prepareRename(document: LangiumDocument, params: PrepareRenameParams): Range | undefined {\n return this.wanted(document, params) ? leafAt(document, params.position)?.range : undefined;\n }\n\n /**\n * The symbol under the cursor, when it is one this can rewrite.\n *\n * A built-in decorator has no source to rewrite, and changing one use of it\n * would break the program while looking like a rename.\n */\n private wanted(\n document: LangiumDocument,\n params: { position: PrepareRenameParams[\"position\"] },\n ): FoundSymbol | undefined {\n const symbol = symbolAt(document, params.position);\n if (!symbol) return undefined;\n if (symbol.kind === \"deco\" && !declaresDeco(this.documents, symbol.name)) return undefined;\n return symbol;\n }\n}\n\nfunction rewrites(occurrences: readonly Occurrence[], newName: string): TextEdit[] {\n const edits: TextEdit[] = [];\n for (const each of occurrences) {\n const range = rangeOf(each);\n if (range) edits.push({ range, newText: newName });\n }\n return edits;\n}\n","import {\n type ActionCall,\n isActionCall,\n isAnnotation,\n isMatcherClause,\n isRunStmt,\n} from \"@venn-lang/core\";\nimport { GrammarUtils } from \"langium\";\nimport { SemanticTokenModifiers, SemanticTokenTypes } from \"vscode-languageserver\";\nimport type { HighlightArgs } from \"./highlight.types.js\";\n\n/** Everything that reads as an invocation: actions, matchers, fragments, annotations. */\nexport function highlightCalls(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (isActionCall(node)) target(node, args);\n else if (isMatcherClause(node))\n acceptor({ node, property: \"name\", type: SemanticTokenTypes.method });\n else if (isAnnotation(node))\n acceptor({ node, property: \"name\", type: SemanticTokenTypes.decorator });\n else if (isRunStmt(node)) runTarget(args);\n}\n\nfunction runTarget(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (!isRunStmt(node)) return;\n // The same type the declaration carries: what `run` names is a fragment, and\n // the two places the reader sees that name should agree about what it is.\n acceptor({ node, property: \"target\", type: SemanticTokenTypes.macro });\n if (node.bind) {\n const type = SemanticTokenTypes.variable;\n acceptor({ node, property: \"bind\", type, modifier: SemanticTokenModifiers.declaration });\n }\n}\n\n// `http.get` is a single grammar token: colour the namespace and the action apart.\nfunction target(node: ActionCall, args: HighlightArgs): void {\n const cst = GrammarUtils.findNodeForProperty(node.$cstNode, \"target\");\n if (!cst) return;\n const dot = node.target.indexOf(\".\");\n const { line, character } = cst.range.start;\n const known = dot > 0 && args.catalog.hasNamespace(node.target.slice(0, dot));\n const modifier = known ? SemanticTokenModifiers.defaultLibrary : [];\n if (dot > 0) {\n const options = { line, char: character, length: dot, type: SemanticTokenTypes.namespace };\n args.acceptor({ ...options, modifier });\n }\n const from = dot > 0 ? dot + 1 : 0;\n const length = node.target.length - from;\n args.acceptor({\n line,\n char: character + from,\n length,\n type: SemanticTokenTypes.function,\n modifier,\n });\n}\n","import {\n type AstNode,\n isBreakStmt,\n isCaptureStmt,\n isConfigDecl,\n isContinueStmt,\n isDatasetDecl,\n isDecoDecl,\n isDocument,\n isExpectStmt,\n isFactoryDecl,\n isFlowDecl,\n isFnDecl,\n isForEachStmt,\n isFragmentDecl,\n isGroupDecl,\n isIfStmt,\n isLetStmt,\n isLifecycleDecl,\n isMatrixDecl,\n isParallelStmt,\n isRaceStmt,\n isRepeatStmt,\n isReportDecl,\n isReturnStmt,\n isRunStmt,\n isStepDecl,\n isTryStmt,\n isTypeDecl,\n isUseDecl,\n isValueImport,\n isWhileStmt,\n} from \"@venn-lang/core\";\nimport type { SemanticTokenAcceptor } from \"langium/lsp\";\nimport { SemanticTokenModifiers, SemanticTokenTypes } from \"vscode-languageserver\";\n\n// §23: `keyword.declaration` is the LSP `keyword` type plus the `declaration`\n// modifier, for the words that introduce a name. The rest are plain keywords.\nconst DECLARING = new Set([\"module\", \"use\", \"import\", \"fn\", \"deco\", \"fragment\", \"type\"]);\n\n/** Emit a keyword token for each literal keyword this node owns. */\nexport function highlightKeywords(node: AstNode, acceptor: SemanticTokenAcceptor): void {\n for (const word of keywordsOf(node)) {\n acceptor({\n node,\n keyword: word,\n type: SemanticTokenTypes.keyword,\n modifier: DECLARING.has(word) ? SemanticTokenModifiers.declaration : [],\n });\n }\n}\n\nfunction keywordsOf(node: AstNode): string[] {\n return declarations(node) ?? bindings(node) ?? control(node) ?? [];\n}\n\nfunction declarations(node: AstNode): string[] | undefined {\n if (isDocument(node)) return node.name ? [\"module\"] : [];\n if (isUseDecl(node)) return node.alias ? [\"use\", \"as\"] : [\"use\"];\n if (isValueImport(node)) return [\"import\", \"from\"];\n if (isFlowDecl(node)) return [\"flow\"];\n if (isFragmentDecl(node)) return [\"fragment\"];\n if (isFnDecl(node)) return [\"fn\", \"return\"];\n if (isDecoDecl(node)) return [\"deco\"];\n if (isTypeDecl(node)) return [\"type\"];\n if (isFactoryDecl(node)) return [\"factory\"];\n if (isDatasetDecl(node)) return [\"dataset\"];\n return undefined;\n}\n\nfunction bindings(node: AstNode): string[] | undefined {\n if (isConfigDecl(node)) return [\"config\"];\n if (isMatrixDecl(node)) return [\"matrix\"];\n if (isReportDecl(node)) return [\"report\"];\n if (isLetStmt(node)) return [node.kind];\n if (isCaptureStmt(node)) return node.opts ? [\"capture\"] : [\"capture\"];\n if (isRunStmt(node)) return node.bind ? [\"run\", \"as\"] : [\"run\"];\n if (isExpectStmt(node)) return expectWords(node.modifier, node.negate);\n return undefined;\n}\n\nfunction control(node: AstNode): string[] | undefined {\n if (isStepDecl(node)) return [\"step\"];\n if (isGroupDecl(node)) return [\"group\"];\n if (isIfStmt(node)) return node.otherwise ? [\"if\", \"else\"] : [\"if\"];\n if (isForEachStmt(node)) return [\"forEach\", \"in\"];\n if (isRepeatStmt(node)) return node.index ? [\"repeat\", \"as\"] : [\"repeat\"];\n if (isWhileStmt(node)) return [\"while\"];\n if (isParallelStmt(node)) return [\"parallel\"];\n if (isRaceStmt(node)) return [\"race\"];\n if (isTryStmt(node)) return tryWords(node.handler, node.finalizer);\n if (isLifecycleDecl(node)) return [node.hook ?? \"on\"];\n return loops(node);\n}\n\nfunction loops(node: AstNode): string[] | undefined {\n if (isReturnStmt(node)) return [\"return\"];\n if (isBreakStmt(node)) return [\"break\"];\n if (isContinueStmt(node)) return [\"continue\"];\n return undefined;\n}\n\nfunction expectWords(modifier: string | undefined, negate: boolean | undefined): string[] {\n const words = [\"expect\"];\n if (modifier) words.push(modifier);\n if (negate) words.push(\"not\");\n return words;\n}\n\nfunction tryWords(handler: unknown, finalizer: unknown): string[] {\n const words = [\"try\"];\n if (handler) words.push(\"catch\");\n if (finalizer) words.push(\"finally\");\n return words;\n}\n","import {\n EXPRESSION_OFFSET,\n type Expr,\n type InterpolationSlot,\n isCall,\n isMember,\n isPrelude,\n isRef,\n isStringLit,\n type Member,\n parseExpression,\n scanInterpolations,\n} from \"@venn-lang/core\";\nimport { AstUtils, type CstNode, GrammarUtils } from \"langium\";\nimport type { SemanticTokenAcceptor } from \"langium/lsp\";\nimport { type Range, SemanticTokenTypes } from \"vscode-languageserver\";\nimport type { TextDocument } from \"vscode-languageserver-textdocument\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { pathOf } from \"../document/index.js\";\nimport type { HighlightArgs } from \"./highlight.types.js\";\n\ninterface Segment {\n offset: number;\n length: number;\n type: string;\n}\n\n/**\n * A string holding `${…}` is not one string token: the placeholders carry code,\n * and code the editor paints as prose is code nobody can read.\n *\n * Returns whether it claimed the node, so the plain-literal pass leaves it\n * alone: semantic tokens must not overlap.\n */\nexport function highlightInterpolation(args: HighlightArgs): boolean {\n const { node, acceptor } = args;\n if (!isStringLit(node) || !node.$cstNode) return false;\n const raw = node.$cstNode.text;\n const slots = scanInterpolations(raw);\n if (slots.length === 0) return false;\n const doc = AstUtils.getDocument(node).textDocument;\n emitSegments({ acceptor, doc, raw, base: node.$cstNode.offset, slots, catalog: args.catalog });\n return true;\n}\n\ninterface EmitArgs {\n acceptor: SemanticTokenAcceptor;\n doc: TextDocument;\n base: number;\n catalog: SymbolCatalog;\n}\n\nfunction emitSegments(args: EmitArgs & { raw: string; slots: readonly InterpolationSlot[] }): void {\n let cursor = 0;\n for (const slot of args.slots) {\n const tail = slot.sourceStart + slot.source.length;\n emit(args, { offset: cursor, length: slot.start - cursor, type: SemanticTokenTypes.string });\n emit(args, { offset: slot.start, length: 2, type: SemanticTokenTypes.operator });\n for (const part of expressionSegments(slot, args.catalog)) emit(args, part);\n emit(args, { offset: tail, length: slot.end - tail, type: SemanticTokenTypes.operator });\n cursor = slot.end;\n }\n emit(args, { offset: cursor, length: args.raw.length - cursor, type: SemanticTokenTypes.string });\n}\n\n/** One token. Empty spans are skipped: a placeholder can sit flush to a quote. */\nfunction emit(args: EmitArgs, segment: Segment): void {\n if (segment.length <= 0) return;\n args.acceptor({\n range: rangeAt(args.doc, args.base + segment.offset, segment.length),\n type: segment.type,\n });\n}\n\nfunction rangeAt(doc: TextDocument, offset: number, length: number): Range {\n return { start: doc.positionAt(offset), end: doc.positionAt(offset + length) };\n}\n\n/**\n * The tokens inside one placeholder, in document order. A placeholder that does\n * not parse stays plain string; the validator is what complains about it.\n */\nfunction expressionSegments(slot: InterpolationSlot, catalog: SymbolCatalog): Segment[] {\n const expr = parseExpression(slot.source);\n if (!expr) {\n return [\n { offset: slot.sourceStart, length: slot.source.length, type: SemanticTokenTypes.string },\n ];\n }\n const shift = slot.sourceStart - EXPRESSION_OFFSET;\n return namedParts(expr, catalog)\n .map((part) => ({ ...part, offset: part.offset + shift }))\n .sort((left, right) => left.offset - right.offset);\n}\n\n/**\n * Classify the names inside a placeholder the same way code outside one is\n * classified: a namespace head reads as a namespace, a called member as a\n * method, a plain read as a property. Anything less and `${fmt.json(xs.map(f))}`\n * comes out as flat prose.\n */\nfunction namedParts(expr: Expr, catalog: SymbolCatalog): Segment[] {\n const found: Segment[] = [];\n for (const node of AstUtils.streamAst(expr)) {\n if (isRef(node)) collect(found, node.$cstNode, headType(node.name, catalog));\n else if (isMember(node)) {\n const cst = GrammarUtils.findNodeForProperty(node.$cstNode, \"member\");\n collect(found, cst, memberTokenType(node, catalog));\n }\n }\n return found;\n}\n\n/** The head of `fmt.json` is a namespace; a prelude name reads as a function. */\nfunction headType(name: string, catalog: SymbolCatalog): string {\n if (catalog.hasNamespace(name)) return SemanticTokenTypes.namespace;\n return isPrelude(name) ? SemanticTokenTypes.function : SemanticTokenTypes.variable;\n}\n\nfunction memberTokenType(node: Member, catalog: SymbolCatalog): string {\n const path = pathOf(node);\n const dot = path?.indexOf(\".\") ?? -1;\n if (path && dot > 0 && catalog.hasNamespace(path.slice(0, dot))) {\n return catalog.action(path.slice(0, dot), path.slice(dot + 1))\n ? SemanticTokenTypes.function\n : SemanticTokenTypes.property;\n }\n return isCall(node.$container) && node.$container.callee === node\n ? SemanticTokenTypes.method\n : SemanticTokenTypes.property;\n}\n\nfunction collect(into: Segment[], cst: CstNode | undefined, type: string): void {\n if (cst) into.push({ offset: cst.offset, length: cst.length, type });\n}\n","import { isCall, isMember, isRef, MEMBER_DOCS } from \"@venn-lang/core\";\nimport { SemanticTokenModifiers, SemanticTokenTypes } from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { findBinding, pathOf } from \"../document/index.js\";\nimport type { HighlightArgs } from \"./highlight.types.js\";\n\nconst LIB = SemanticTokenModifiers.defaultLibrary;\n\n/** Every built-in member name, whatever kind of value it hangs off. */\nconst BUILT_IN = new Set(Object.values(MEMBER_DOCS).flatMap((table) => Object.keys(table)));\n\n/**\n * Colour what a `.` reaches. The parser cannot tell `http.post` from\n * `res.status`, since both are member chains, so the catalog and the built-in\n * tables decide: a plugin verb reads as a function, a built-in as a method, and\n * anything else as the field it is.\n *\n * Returns whether it claimed the node; tokens must not overlap.\n */\nexport function highlightPath(args: HighlightArgs): boolean {\n const { node, acceptor } = args;\n if (isRef(node)) return namespaceHead(node.name, args);\n if (!isMember(node)) return false;\n acceptor({ node, property: \"member\", ...memberToken(node.member, args) });\n return true;\n}\n\ninterface Token {\n type: string;\n modifier?: string | string[];\n}\n\n/** A plugin verb, a built-in method, or an ordinary field. */\nfunction memberToken(member: string, args: HighlightArgs): Token {\n const path = pathOf(args.node);\n if (path && isStdlibPath(path, args)) return stdlibToken(path, args.catalog);\n if (BUILT_IN.has(member)) {\n return { type: methodOrProperty(args), modifier: LIB };\n }\n return { type: SemanticTokenTypes.property };\n}\n\n/** `xs.map(…)` is a method; `xs.len` is a property, read without parentheses. */\nfunction methodOrProperty(args: HighlightArgs): string {\n return isCall(args.node.$container) && args.node.$container.callee === args.node\n ? SemanticTokenTypes.method\n : SemanticTokenTypes.property;\n}\n\n/** The head of `http.post` is a namespace, not a variable nobody declared. */\nfunction namespaceHead(name: string, args: HighlightArgs): boolean {\n if (!isNamespace(name, args)) return false;\n args.acceptor({\n node: args.node,\n property: \"name\",\n type: SemanticTokenTypes.namespace,\n modifier: LIB,\n });\n return true;\n}\n\n/** Scope wins: a variable named `auth` stays a variable even though `auth` is a namespace. */\nfunction isNamespace(name: string, args: HighlightArgs): boolean {\n return args.catalog.hasNamespace(name) && !findBinding(args.node, name);\n}\n\n/** The last segment is the verb when the whole path names an action. */\nfunction stdlibToken(path: string, catalog: SymbolCatalog): Token {\n const namespace = path.slice(0, path.indexOf(\".\"));\n const name = path.slice(path.indexOf(\".\") + 1);\n const type = catalog.action(namespace, name)\n ? SemanticTokenTypes.function\n : SemanticTokenTypes.property;\n return { type, modifier: LIB };\n}\n\nfunction isStdlibPath(path: string, args: HighlightArgs): boolean {\n const dot = path.indexOf(\".\");\n return dot > 0 && isNamespace(path.slice(0, dot), args);\n}\n","import {\n isBoolLit,\n isInstantLit,\n isMapEntry,\n isMember,\n isNamedType,\n isNullLit,\n isNumberLit,\n isRef,\n isStringLit,\n} from \"@venn-lang/core\";\nimport { SemanticTokenTypes } from \"vscode-languageserver\";\nimport type { HighlightArgs } from \"./highlight.types.js\";\nimport { highlightInterpolation } from \"./highlight-interpolation.js\";\nimport { highlightPath } from \"./highlight-paths.js\";\n\n/** Literals, references and type names inside expressions. */\nexport function highlightLiterals(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (isStringLit(node)) {\n // An interpolated string is painted piece by piece; tokens cannot overlap.\n if (!highlightInterpolation(args)) {\n acceptor({ node, property: \"value\", type: SemanticTokenTypes.string });\n }\n } else if (isNumberLit(node))\n acceptor({ node, property: \"raw\", type: SemanticTokenTypes.number });\n else if (isInstantLit(node))\n acceptor({ node, property: \"value\", type: SemanticTokenTypes.number });\n else if (isBoolLit(node)) acceptor({ node, property: \"value\", type: SemanticTokenTypes.keyword });\n // A stdlib path (`http.post`) is a call, not a variable; the catalog decides.\n else if (isRef(node) || isMember(node)) {\n if (!highlightPath(args) && isRef(node)) {\n acceptor({ node, property: \"name\", type: SemanticTokenTypes.variable });\n }\n } else if (isNamedType(node)) acceptor({ node, property: \"name\", type: SemanticTokenTypes.type });\n else if (isMapEntry(node)) acceptor({ node, property: \"key\", type: SemanticTokenTypes.property });\n else if (isNullLit(node)) acceptor({ node, keyword: \"null\", type: SemanticTokenTypes.keyword });\n}\n","import { isDocument, isUseDecl, isValueImport, type ValueImport } from \"@venn-lang/core\";\nimport { SemanticTokenModifiers, SemanticTokenTypes } from \"vscode-languageserver\";\nimport type { HighlightArgs } from \"./highlight.types.js\";\n\nconst DECLARATION = SemanticTokenModifiers.declaration;\n\n/**\n * The module header. These are plain string properties in the grammar, not\n * expression nodes, so nothing else would ever colour them.\n */\nexport function highlightModule(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (isDocument(node) && node.name) {\n acceptor({ node, property: \"name\", type: SemanticTokenTypes.namespace });\n } else if (isUseDecl(node)) {\n acceptor({ node, property: \"pkg\", type: SemanticTokenTypes.string });\n if (node.alias) {\n const type = SemanticTokenTypes.namespace;\n acceptor({ node, property: \"alias\", type, modifier: DECLARATION });\n }\n } else if (isValueImport(node)) {\n importedNames(node, args);\n }\n}\n\nfunction importedNames(node: ValueImport, args: HighlightArgs): void {\n const { acceptor } = args;\n acceptor({ node, property: \"path\", type: SemanticTokenTypes.string });\n node.names.forEach((_name, index) => {\n acceptor({ node, property: \"names\", index, type: SemanticTokenTypes.function });\n });\n const bound = node.wildcard ?? node.default;\n if (!bound) return;\n const property = node.wildcard ? \"wildcard\" : \"default\";\n acceptor({ node, property, type: SemanticTokenTypes.namespace, modifier: DECLARATION });\n}\n","import {\n isCaptureStmt,\n isDatasetDecl,\n isDecoDecl,\n isFactoryDecl,\n isFieldDecl,\n isFlowDecl,\n isFnDecl,\n isForEachStmt,\n isFragmentDecl,\n isGroupDecl,\n isLetStmt,\n isLifecycleDecl,\n isParam,\n isRepeatStmt,\n isStepDecl,\n isTryStmt,\n isTypeDecl,\n} from \"@venn-lang/core\";\nimport { SemanticTokenModifiers, SemanticTokenTypes } from \"vscode-languageserver\";\nimport type { HighlightArgs } from \"./highlight.types.js\";\n\nconst DECLARATION = SemanticTokenModifiers.declaration;\nconst CALLABLE = { type: SemanticTokenTypes.function, modifier: DECLARATION } as const;\n/**\n * A `fragment` is invoked, not called: `run` expands it into the steps it\n * declares, which the report then records. `macro` is the standard type that\n * carries that meaning, and, crucially, themes draw it apart from a function.\n * Painting the two alike would claim they are one kind of thing, which is the\n * mistake the checker refuses.\n */\nconst FRAGMENT = { type: SemanticTokenTypes.macro, modifier: DECLARATION } as const;\nconst VALUE = { type: SemanticTokenTypes.variable, modifier: DECLARATION } as const;\n\n/** Every name a declaration introduces, plus the titles that label a flow. */\nexport function highlightNames(args: HighlightArgs): void {\n callableNames(args);\n decoratorNames(args);\n valueNames(args);\n memberNames(args);\n boundNames(args);\n titles(args);\n}\n\n// `deco memoize` and `@memoize` are one thing seen twice, so they colour alike.\nfunction decoratorNames(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (!isDecoDecl(node)) return;\n acceptor({ node, property: \"name\", type: SemanticTokenTypes.decorator, modifier: DECLARATION });\n}\n\nfunction callableNames(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (isFragmentDecl(node)) acceptor({ node, property: \"name\", ...FRAGMENT });\n else if (isFnDecl(node)) acceptor({ node, property: \"name\", ...CALLABLE });\n else if (isFactoryDecl(node)) acceptor({ node, property: \"name\", ...CALLABLE });\n}\n\nfunction valueNames(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (isCaptureStmt(node)) acceptor({ node, property: \"name\", ...VALUE });\n else if (isDatasetDecl(node)) acceptor({ node, property: \"name\", ...VALUE });\n else if (isLetStmt(node)) acceptor({ node, property: \"name\", ...readonlyFor(node.kind) });\n}\n\nfunction memberNames(args: HighlightArgs): void {\n const { node, acceptor } = args;\n const type = SemanticTokenTypes.type;\n if (isParam(node)) acceptor({ node, property: \"name\", type: SemanticTokenTypes.parameter });\n else if (isTypeDecl(node)) acceptor({ node, property: \"name\", type, modifier: DECLARATION });\n else if (isFieldDecl(node)) acceptor({ node, property: \"name\", type: \"property\" });\n}\n\n// Names bound by a construct rather than declared: loop variables, `catch err`, `on <event>`.\nfunction boundNames(args: HighlightArgs): void {\n const { node, acceptor } = args;\n if (isForEachStmt(node)) acceptor({ node, property: \"item\", ...VALUE });\n else if (isRepeatStmt(node) && node.index) acceptor({ node, property: \"index\", ...VALUE });\n else if (isTryStmt(node) && node.error) acceptor({ node, property: \"error\", ...VALUE });\n else if (isLifecycleDecl(node) && node.event) {\n acceptor({ node, property: \"event\", type: SemanticTokenTypes.enumMember });\n }\n}\n\nfunction titles(args: HighlightArgs): void {\n const { node, acceptor } = args;\n const title = { property: \"title\", type: SemanticTokenTypes.string } as const;\n if (isFlowDecl(node)) acceptor({ node, ...title });\n else if (isStepDecl(node)) acceptor({ node, ...title });\n else if (isGroupDecl(node)) acceptor({ node, ...title });\n}\n\nfunction readonlyFor(kind: string): { type: string; modifier: string[] } {\n const modifier =\n kind === \"const\" ? [DECLARATION, SemanticTokenModifiers.readonly] : [DECLARATION];\n return { type: SemanticTokenTypes.variable, modifier };\n}\n","import type { AstNode } from \"langium\";\nimport { AbstractSemanticTokenProvider, type SemanticTokenAcceptor } from \"langium/lsp\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport { highlightCalls } from \"./highlight-calls.js\";\nimport { highlightKeywords } from \"./highlight-keywords.js\";\nimport { highlightLiterals } from \"./highlight-literals.js\";\nimport { highlightModule } from \"./highlight-module.js\";\nimport { highlightNames } from \"./highlight-names.js\";\n\n/**\n * Colours a `.vn` the way §23 specifies. The grammar cannot tell `http.post`\n * from `myHelper.foo`, since both are `ActionCall`, so the catalog decides.\n * Each pass owns one family of tokens, and a node matches at most one of them.\n */\nexport class VennSemanticTokenProvider extends AbstractSemanticTokenProvider {\n private readonly catalog: SymbolCatalog;\n\n constructor(services: VennServices) {\n super(services);\n this.catalog = services.catalog;\n }\n\n protected override highlightElement(node: AstNode, acceptor: SemanticTokenAcceptor): void {\n const args = { node, acceptor, catalog: this.catalog };\n highlightKeywords(node, acceptor);\n highlightModule(args);\n highlightCalls(args);\n highlightLiterals(args);\n highlightNames(args);\n }\n}\n","import { type Document, type ImportDecl, isUseDecl, isValueImport } from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { Position, TextEdit } from \"vscode-languageserver\";\n\n/** Which header group a new line joins. `use` always precedes `import`. */\nexport type HeaderKind = \"use\" | \"import\";\n\n/**\n * Insert a header line after the last one of its own kind, so `use` lines stay\n * grouped above `import` lines rather than landing wherever the header ends.\n */\nexport function headerEdit(document: LangiumDocument, line: string, kind: HeaderKind): TextEdit {\n const position = anchor(document, kind);\n return { range: { start: position, end: position }, newText: `${line}\\n` };\n}\n\nfunction anchor(document: LangiumDocument, kind: HeaderKind): Position {\n const root = document.parseResult?.value as Document | undefined;\n const imports = root?.imports ?? [];\n const preferred = last(imports, kind === \"use\" ? isUseDecl : isValueImport);\n const fallback = kind === \"import\" ? last(imports, isUseDecl) : undefined;\n const end = endOf(preferred ?? fallback) ?? moduleEnd(root);\n if (end === undefined) return { line: 0, character: 0 };\n return { line: document.textDocument.positionAt(end).line + 1, character: 0 };\n}\n\nfunction last(\n imports: readonly ImportDecl[],\n is: (node: ImportDecl) => boolean,\n): ImportDecl | undefined {\n return [...imports].reverse().find((decl) => is(decl));\n}\n\nfunction endOf(decl: ImportDecl | undefined): number | undefined {\n const cst = decl?.$cstNode;\n return cst ? cst.offset + cst.length : undefined;\n}\n\nfunction moduleEnd(root: Document | undefined): number | undefined {\n if (!root?.name || !root.$cstNode) return undefined;\n const newline = root.$cstNode.text.indexOf(\"\\n\");\n return newline < 0 ? undefined : root.$cstNode.offset + newline;\n}\n\n/** True when the file already has an `import` naming this module path. */\nexport function alreadyImports(document: LangiumDocument, path: string): boolean {\n const root = document.parseResult?.value as Document | undefined;\n return (root?.imports ?? []).some((decl) => isValueImport(decl) && decl.path === path);\n}\n","import { type Dirent, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { parse } from \"@venn-lang/core\";\nimport { type URI, UriUtils } from \"langium\";\nimport { exportedNames } from \"../document/index.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\nconst EXTENSION = \".vn\";\nconst MAX_DEPTH = 4;\nconst SKIP = new Set([\"node_modules\", \"dist\", \".git\"]);\n\n/** A module that exports the wanted name, and how to write its specifier. */\nexport interface ExportingModule {\n specifier: string;\n file: string;\n}\n\n/**\n * Every `.vn` file near this one that marks `name` as `pub`. Specifiers prefer\n * a configured `#alias`, falling back to a relative path.\n */\nexport function modulesExporting(args: {\n name: string;\n base: URI;\n imports: ImportResolver;\n}): ExportingModule[] {\n const aliases = args.imports.aliases(args.base);\n const root = UriUtils.dirname(args.base);\n const found: ExportingModule[] = [];\n for (const file of walk(root.fsPath, \"\", 0)) {\n if (!exportsName(join(root.fsPath, file), args.name)) continue;\n found.push({ specifier: specifierFor(file, root, aliases), file });\n }\n return found;\n}\n\nfunction exportsName(path: string, name: string): boolean {\n try {\n const { ast, problems } = parse(readFileSync(path, \"utf8\"), { uri: path });\n return problems.length === 0 && exportedNames(ast).some((each) => each.name === name);\n } catch {\n return false;\n }\n}\n\n// `#shared/auth.vn` reads better than `./shared/auth.vn` when an alias covers it.\nfunction specifierFor(file: string, root: URI, aliases: Record<string, URI>): string {\n const absolute = UriUtils.resolvePath(root, file).toString();\n for (const [alias, folder] of Object.entries(aliases)) {\n const prefix = `${folder.toString()}/`;\n if (absolute.startsWith(prefix)) return `${alias}/${absolute.slice(prefix.length)}`;\n }\n return `./${file}`;\n}\n\nfunction walk(root: string, relative: string, depth: number): string[] {\n if (depth > MAX_DEPTH) return [];\n const found: string[] = [];\n for (const entry of read(join(root, relative))) {\n const child = relative ? `${relative}/${entry.name}` : entry.name;\n if (entry.isDirectory() && !SKIP.has(entry.name)) found.push(...walk(root, child, depth + 1));\n else if (entry.isFile() && entry.name.endsWith(EXTENSION)) found.push(child);\n }\n return found;\n}\n\nfunction read(directory: string): Dirent[] {\n try {\n return readdirSync(directory, { withFileTypes: true });\n } catch {\n return [];\n }\n}\n","import {\n type AstNode,\n isActionCall,\n isLetStmt,\n isMatcherClause,\n isRunStmt,\n isStringLit,\n} from \"@venn-lang/core\";\nimport { CstUtils, type LangiumDocument } from \"langium\";\nimport type { CodeActionProvider } from \"langium/lsp\";\nimport {\n type CodeAction,\n CodeActionKind,\n type CodeActionParams,\n type Diagnostic,\n type TextEdit,\n} from \"vscode-languageserver\";\nimport type { SymbolCatalog } from \"../catalog/index.js\";\nimport { pathOf } from \"../document/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\nimport { alreadyImports, headerEdit } from \"./anchor.js\";\nimport { modulesExporting } from \"./exporting-modules.js\";\n\ninterface FixArgs {\n title: string;\n edit: TextEdit;\n document: LangiumDocument;\n diagnostic: Diagnostic;\n preferred: boolean;\n}\n\n/**\n * Lightbulb fixes for the two \"you never brought this in\" diagnostics. When more\n * than one source provides the name, every source is offered and the first is\n * marked preferred, so the editor shows it first and applies it on Quick Fix.\n */\nexport class VennCodeActionProvider implements CodeActionProvider {\n private readonly catalog: SymbolCatalog;\n private readonly imports: ImportResolver;\n\n constructor(services: VennServices) {\n this.catalog = services.catalog;\n this.imports = services.imports;\n }\n\n getCodeActions(document: LangiumDocument, params: CodeActionParams): CodeAction[] {\n return params.context.diagnostics.flatMap((diagnostic) => this.fixes(diagnostic, document));\n }\n\n private fixes(diagnostic: Diagnostic, document: LangiumDocument): CodeAction[] {\n if (diagnostic.code === \"VN2007\") return this.addUse(diagnostic, document);\n if (diagnostic.code === \"VN2005\") return this.addImport(diagnostic, document);\n if (diagnostic.code === \"VN5001\") return this.useLet(diagnostic, document);\n return [];\n }\n\n private addUse(diagnostic: Diagnostic, document: LangiumDocument): CodeAction[] {\n const node = nodeAt(document, diagnostic);\n return this.sources(node).map((pkg, index) =>\n fix({\n title: `Add use \"${pkg}\"`,\n edit: headerEdit(document, `use \"${pkg}\"`, \"use\"),\n document,\n diagnostic,\n preferred: index === 0,\n }),\n );\n }\n\n /** Every package that would bring this name in, as action, matcher or call. */\n private sources(node: AstNode | undefined): readonly string[] {\n if (!node) return [];\n if (isMatcherClause(node)) {\n const found = this.catalog.matcher(node.name);\n return found ? [found.package] : [];\n }\n // The read may hide inside `${…}`, where the node is the string, not a path.\n if (isStringLit(node)) return this.interpolatedSources(node);\n // A bare path counts too: `env.BASE_URL` is a read, and it still needs a `use`.\n const path = isActionCall(node) ? node.target : pathOf(isLetStmt(node) ? node.value : node);\n const namespace = path?.split(\".\")[0];\n return namespace ? this.catalog.packagesFor(namespace) : [];\n }\n\n /** The package for the first namespace read in `\"…${env.X}…\"` we recognise. */\n private interpolatedSources(node: { value?: string }): readonly string[] {\n for (const match of (node.value ?? \"\").matchAll(/\\$\\{\\s*([A-Za-z_]\\w*)\\./g)) {\n const packages = this.catalog.packagesFor(match[1] ?? \"\");\n if (packages.length > 0) return packages;\n }\n return [];\n }\n\n /** `capture` is spelled `let`, so the fix is exactly one word wide. */\n private useLet(diagnostic: Diagnostic, document: LangiumDocument): CodeAction[] {\n const { start } = diagnostic.range;\n const end = { line: start.line, character: start.character + \"capture\".length };\n const edit = { range: { start, end }, newText: \"let\" };\n return [\n fix({ title: \"Replace `capture` with `let`\", edit, document, diagnostic, preferred: true }),\n ];\n }\n\n private addImport(diagnostic: Diagnostic, document: LangiumDocument): CodeAction[] {\n const node = nodeAt(document, diagnostic);\n if (!node || !isRunStmt(node)) return [];\n const name = node.target;\n const modules = modulesExporting({ name, base: document.uri, imports: this.imports });\n return modules\n .filter((module) => !alreadyImports(document, module.specifier))\n .map((module, index) =>\n fix({\n title: `Import ${name} from \"${module.specifier}\"`,\n edit: headerEdit(document, `import { ${name} } from \"${module.specifier}\"`, \"import\"),\n document,\n diagnostic,\n preferred: index === 0,\n }),\n );\n }\n}\n\nfunction fix(args: FixArgs): CodeAction {\n return {\n title: args.title,\n kind: CodeActionKind.QuickFix,\n diagnostics: [args.diagnostic],\n isPreferred: args.preferred,\n edit: { changes: { [args.document.uri.toString()]: [args.edit] } },\n };\n}\n\nfunction nodeAt(document: LangiumDocument, diagnostic: Diagnostic): AstNode | undefined {\n const root = document.parseResult?.value?.$cstNode;\n if (!root) return undefined;\n const offset = document.textDocument.offsetAt(diagnostic.range.start);\n return CstUtils.findLeafNodeAtOffset(root, offset)?.astNode;\n}\n","import {\n type AstNode,\n type Block,\n type Document,\n isDecoDecl,\n isFlowDecl,\n isFragmentDecl,\n isGroupDecl,\n isStepDecl,\n} from \"@venn-lang/core\";\nimport type { LangiumDocument } from \"langium\";\nimport type { DocumentSymbolProvider } from \"langium/lsp\";\nimport { type DocumentSymbol, SymbolKind } from \"vscode-languageserver\";\n\nconst ORIGIN = { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };\n\n/** The outline: flows with their steps and groups, plus fragments and resources. */\nexport class VennDocumentSymbolProvider implements DocumentSymbolProvider {\n getSymbols(document: LangiumDocument): DocumentSymbol[] {\n const root = document.parseResult?.value as Document | undefined;\n return root ? root.decls.flatMap(topSymbol) : [];\n }\n}\n\nfunction topSymbol(decl: AstNode): DocumentSymbol[] {\n if (isFlowDecl(decl)) {\n const children = blockSymbols(decl.body);\n return [symbol({ node: decl, name: decl.title, kind: SymbolKind.Event, children })];\n }\n if (isFragmentDecl(decl)) {\n return [symbol({ node: decl, name: decl.name, kind: SymbolKind.Function })];\n }\n // A `deco` is a declaration a reader looks for by name, like a fragment.\n if (isDecoDecl(decl)) {\n return [symbol({ node: decl, name: decl.name, kind: SymbolKind.Function })];\n }\n return [];\n}\n\nfunction blockSymbols(block: Block): DocumentSymbol[] {\n return block.stmts.flatMap((stmt) => {\n if (isStepDecl(stmt)) {\n const children = blockSymbols(stmt.body);\n return [symbol({ node: stmt, name: stmt.title, kind: SymbolKind.Method, children })];\n }\n if (isGroupDecl(stmt)) {\n const children = blockSymbols(stmt.body);\n return [symbol({ node: stmt, name: stmt.title, kind: SymbolKind.Namespace, children })];\n }\n return [];\n });\n}\n\nfunction symbol(args: {\n node: AstNode;\n name: string;\n kind: SymbolKind;\n children?: DocumentSymbol[];\n}): DocumentSymbol {\n const range = args.node.$cstNode?.range ?? ORIGIN;\n return {\n name: args.name,\n kind: args.kind,\n range,\n selectionRange: range,\n children: args.children,\n };\n}\n","import {\n type AstNode,\n checkTypes,\n type Document,\n type Expr,\n type ImportedDeco,\n importedTypes,\n isPackageSpecifier,\n isValueImport,\n type Problem,\n type Type,\n type TypeCatalog,\n} from \"@venn-lang/core\";\nimport { createTypeCatalog } from \"@venn-lang/runtime\";\nimport { allPlugins } from \"@venn-lang/stdlib\";\nimport type { TypeSpec } from \"@venn-lang/types\";\nimport type { LangiumDocument } from \"langium\";\nimport { importedDecos } from \"../deco/index.js\";\nimport { importedModules, type ModuleGraph } from \"../document/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\n\n/** What inference found for one document: its type errors and every node's type. */\nexport interface DocumentTypes {\n problems: readonly Problem[];\n types: ReadonlyMap<AstNode, Type>;\n /**\n * Per string literal, the expression inference parsed from each `${…}`. The\n * document's own tree stops at the string, so these are the only nodes the\n * editor can reach for code written inside one.\n */\n slots: ReadonlyMap<AstNode, readonly (Expr | undefined)[]>;\n}\n\n/**\n * Type information for the workspace, computed once per parse of a document.\n *\n * Inference walks a whole file, and several features want its result:\n * diagnostics on every edit, hover on every mouse move. Without a shared cache\n * the same file is re-checked many times per keystroke; with it, a file is\n * checked once when it changes and every reader is served from memory.\n */\nexport interface TypeService {\n /** Everything inference knows about this document, cached until it is reparsed. */\n of(document: LangiumDocument): DocumentTypes;\n /** What is already cached, or undefined, for readers that must not block. */\n peek(document: LangiumDocument): DocumentTypes | undefined;\n /** Forget a document: it was deleted, or its folder was closed. */\n forget(uri: string): void;\n}\n\nconst EMPTY: DocumentTypes = { problems: [], types: new Map(), slots: new Map() };\n\ninterface Entry {\n /** The AST this was computed from. A reparse yields a new root, so a stale\n * entry can never be mistaken for a fresh one. A version number could be,\n * since replacing a document resets it to zero. */\n root: object;\n result: DocumentTypes;\n}\n\nexport function createTypeService(services: VennServices): TypeService {\n const cache = new Map<string, Entry>();\n // Built once: reading every plugin's published types on each keystroke would\n // be work the answer never changes for.\n const catalog = createTypeCatalog(allPlugins);\n return {\n of(document) {\n const cached = hit(cache, document);\n if (cached) return cached;\n const root = document.parseResult?.value;\n const result = compute({ document, catalog, ...outside(document, services) });\n if (root) cache.set(document.uri.toString(), { root, result });\n return result;\n },\n peek: (document) => hit(cache, document),\n forget: (uri) => void cache.delete(uri),\n };\n}\n\n/**\n * The `pub deco`s this file imports.\n *\n * Read here rather than in {@link compute} because the services are resolved\n * lazily: touching them while the module is still being built would close a\n * loop that only opens once everything is constructed.\n */\nfunction outside(\n document: LangiumDocument,\n services: VennServices,\n): {\n decos?: Map<string, ImportedDeco>;\n graph?: ModuleGraph;\n packages?: Map<string, Record<string, TypeSpec>>;\n} {\n const root = document.parseResult?.value as Document | undefined;\n if (!root) return {};\n const scope = {\n root,\n uri: document.uri,\n documents: services.shared.workspace.LangiumDocuments,\n imports: services.imports,\n };\n return {\n decos: importedDecos(scope),\n graph: importedModules(scope),\n packages: services.imports.packageTypes(document.uri, packagesNamed(root)),\n };\n}\n\n/** The bare specifiers this file imports: the ones that name a package. */\nfunction packagesNamed(root: Document): string[] {\n return root.imports\n .filter(isValueImport)\n .map((decl) => decl.path)\n .filter(isPackageSpecifier);\n}\n\nfunction hit(cache: Map<string, Entry>, document: LangiumDocument): DocumentTypes | undefined {\n const entry = cache.get(document.uri.toString());\n return entry && entry.root === document.parseResult?.value ? entry.result : undefined;\n}\n\nfunction compute(args: {\n document: LangiumDocument;\n catalog: TypeCatalog;\n decos?: Map<string, ImportedDeco>;\n graph?: ModuleGraph;\n packages?: Map<string, Record<string, TypeSpec>>;\n}): DocumentTypes {\n const { document, catalog, decos, graph } = args;\n const root = document.parseResult?.value as Document | undefined;\n if (!root) return EMPTY;\n const uri = document.uri.toString();\n // What the imported names are, worked out from the files they were written\n // in, so an imported function has a hover and its arguments are checked.\n const imports =\n graph && importedTypes({ ...graph, document: root, uri, catalog, packages: args.packages });\n const checked = checkTypes(root, { uri, catalog, decos, imports });\n return {\n problems: checked.problems,\n types: checked.types as ReadonlyMap<AstNode, Type>,\n slots: checked.slots as ReadonlyMap<AstNode, readonly (Expr | undefined)[]>,\n };\n}\n","import { DocumentState, type LangiumDocument, type URI } from \"langium\";\nimport type { LangiumSharedServices } from \"langium/lsp\";\nimport type { TypeService } from \"./type-service.js\";\n\n/**\n * Keep the workspace's types warm.\n *\n * Langium already indexes every `.vn` in the opened folder, and re-indexes a\n * file when it changes. Hooking the same cycle means the project is fully typed\n * by the time you touch anything, and a keystroke re-types only the file you\n * edited, never the rest.\n */\nexport function warmTypes(shared: LangiumSharedServices, types: TypeService): void {\n const builder = shared.workspace.DocumentBuilder;\n builder.onBuildPhase(DocumentState.IndexedContent, (documents: LangiumDocument[]) => {\n for (const document of documents) warm(document, types);\n });\n builder.onUpdate((_changed: URI[], deleted: URI[]) => {\n for (const uri of deleted) types.forget(uri.toString());\n });\n}\n\n/** Inference must never take the server down: a bad file loses its types, nothing more. */\nfunction warm(document: LangiumDocument, types: TypeService): void {\n try {\n types.of(document);\n } catch {\n types.forget(document.uri.toString());\n }\n}\n","import { ALL_CAPABILITIES } from \"@venn-lang/contracts\";\nimport type { Document, Problem, VennAstType } from \"@venn-lang/core\";\nimport {\n buildRegistry,\n checkDocument,\n checkImports,\n collectFragments,\n type Registry,\n} from \"@venn-lang/runtime\";\nimport { allPlugins } from \"@venn-lang/stdlib\";\nimport {\n AstUtils,\n type LangiumDocument,\n type LangiumDocuments,\n type ValidationAcceptor,\n} from \"langium\";\nimport type { Range } from \"vscode-languageserver\";\nimport { importedFragments, importedModules, type ModuleGraph } from \"../document/index.js\";\nimport { envNames } from \"../env/index.js\";\nimport type { VennServices } from \"../services/lsp.types.js\";\nimport type { TypeService } from \"../types/index.js\";\nimport type { ImportResolver } from \"../workspace/index.js\";\n\n/** Wire the runtime's static check (VN2003/4/5) into the editor's diagnostics. */\nexport function registerVennChecks(services: VennServices): void {\n const registry = buildRegistry({ plugins: allPlugins, caps: ALL_CAPABILITIES });\n const imports = services.imports;\n const types = services.types;\n const documents = services.shared.workspace.LangiumDocuments;\n services.validation.ValidationRegistry.register<VennAstType>({\n Document: (document, accept) =>\n report({ document, accept, registry, imports, types, documents }),\n });\n}\n\nfunction report(args: {\n document: Document;\n accept: ValidationAcceptor;\n registry: Registry;\n imports: ImportResolver;\n types: TypeService;\n documents: LangiumDocuments;\n}): void {\n const langiumDocument = AstUtils.getDocument(args.document);\n const uri = langiumDocument.uri.toString();\n const graph = importedModules({\n root: args.document,\n uri: langiumDocument.uri,\n documents: args.documents,\n imports: args.imports,\n });\n const fragments = knownFragments({ document: args.document, uri, graph });\n const problems = checkDocument({\n document: args.document,\n registry: args.registry,\n fragments,\n env: declaredEnv(args.imports, langiumDocument),\n uri: langiumDocument.uri.toString(),\n });\n // Type errors come from the shared service, so a file is inferred once per\n // change and hover reads the very same result.\n const typed = args.types.of(langiumDocument).problems;\n const imported = checkImports({ document: args.document, uri, graph });\n for (const problem of [...problems, ...typed, ...imported]) emit(problem, args, langiumDocument);\n}\n\n/**\n * The variables `venn.toml` declares, or undefined when there is no manifest.\n * Without one, every `env.*` read would look undeclared.\n */\nfunction declaredEnv(\n imports: ImportResolver,\n document: LangiumDocument,\n): readonly string[] | undefined {\n const sections = imports.env(document.uri);\n return Object.keys(sections).length > 0 ? envNames(sections) : undefined;\n}\n\nfunction emit(\n problem: Problem,\n args: { document: Document; accept: ValidationAcceptor },\n langiumDocument: LangiumDocument,\n): void {\n args.accept(\"error\", problem.title, {\n node: args.document,\n range: rangeOf(problem, langiumDocument),\n code: problem.code,\n });\n}\n\n/**\n * A fragment is known if this file declares one or imported one.\n *\n * Only real fragments count: the neighbouring files say which imported names\n * are fragments, so `run` cannot accept a `pub fn` by mistake.\n */\nfunction knownFragments(args: {\n document: Document;\n uri: string;\n graph: ModuleGraph;\n}): Set<string> {\n return new Set([...collectFragments(args.document).keys(), ...importedFragments(args)]);\n}\n\nfunction rangeOf(problem: Problem, document: LangiumDocument): Range {\n const text = document.textDocument;\n return {\n start: text.positionAt(problem.span.offset),\n end: text.positionAt(problem.span.offset + problem.span.length),\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport {\n createTomlManifest,\n dotenvFiles,\n parseDotenv,\n resolveAlias,\n tomlDocs,\n} from \"@venn-lang/contracts\";\nimport type { TypeSpec } from \"@venn-lang/types\";\nimport { type URI, UriUtils } from \"langium\";\n\n/**\n * Reads the nearest `venn.toml` and answers the project-level questions that\n * depend on it: where an import points, and how this project formats.\n */\nexport interface ImportResolver {\n resolve(spec: string, base: URI): URI;\n /** The `[paths]` aliases visible from a file, and the folder each maps to. */\n aliases(base: URI): Record<string, URI>;\n /** The raw `[format]` table, for {@link formatOptionsFrom}. */\n formatSettings(base: URI): Record<string, unknown>;\n /** Every variable the project declares: `[env.*]` and the dotenv files. */\n env(base: URI): Record<string, Record<string, string>>;\n /** The comment written above each key in `venn.toml`, as its documentation. */\n envDocs(base: URI): Record<string, string>;\n /**\n * What an installed package publishes, derived at install into `target/types/`.\n *\n * Read here rather than derived here: deriving means loading the TypeScript\n * compiler and reading a package's whole declaration graph, which is a second\n * of work and cannot happen on a keystroke. Nothing installed, or nothing\n * derived yet, means an imported name is `dynamic`, which is the truth about\n * it and not a failure.\n */\n packageTypes(base: URI, packages: readonly string[]): Map<string, Record<string, TypeSpec>>;\n}\n\ninterface Manifested {\n root: URI;\n paths: Record<string, string>;\n format: Record<string, unknown>;\n env: Record<string, Record<string, string>>;\n docs: Record<string, string>;\n}\n\nconst MAX_DEPTH = 12;\n\n/**\n * Relative specifiers resolve against the importing file; `#alias/…` resolves\n * through the nearest `venn.toml`, searched upwards and cached per directory.\n */\nexport function createImportResolver(): ImportResolver {\n const cache = new Map<string, Manifested | undefined>();\n return {\n resolve(spec, base) {\n const from = UriUtils.dirname(base);\n if (spec.startsWith(\".\")) return UriUtils.resolvePath(from, spec);\n const found = findManifest(from, cache);\n const alias = found && resolveAlias({ spec, paths: found.paths });\n if (!found || !alias) return UriUtils.resolvePath(from, spec);\n return UriUtils.resolvePath(found.root, alias.dir, alias.rest);\n },\n aliases(base) {\n const found = findManifest(UriUtils.dirname(base), cache);\n if (!found) return {};\n return Object.fromEntries(\n Object.entries(found.paths).map(([key, dir]) => [\n key,\n UriUtils.resolvePath(found.root, dir),\n ]),\n );\n },\n formatSettings(base) {\n return findManifest(UriUtils.dirname(base), cache)?.format ?? {};\n },\n env(base) {\n return findManifest(UriUtils.dirname(base), cache)?.env ?? {};\n },\n packageTypes(base, packages) {\n const found = findManifest(UriUtils.dirname(base), cache);\n const out = new Map<string, Record<string, TypeSpec>>();\n if (!found) return out;\n for (const name of packages) {\n const at = UriUtils.resolvePath(found.root, \"target\", \"types\", `${fileName(name)}.json`);\n const derived = readDerived(at);\n if (derived) out.set(name, derived);\n }\n return out;\n },\n envDocs(base) {\n return findManifest(UriUtils.dirname(base), cache)?.docs ?? {};\n },\n };\n}\n\nfunction findManifest(\n dir: URI,\n cache: Map<string, Manifested | undefined>,\n): Manifested | undefined {\n const key = dir.toString();\n if (cache.has(key)) return cache.get(key);\n const found = search(dir);\n cache.set(key, found);\n return found;\n}\n\nfunction search(start: URI): Manifested | undefined {\n let dir = start;\n for (let depth = 0; depth < MAX_DEPTH; depth++) {\n const manifest = read(UriUtils.resolvePath(dir, \"venn.toml\"));\n if (manifest) return { root: dir, ...manifest, env: withDotenv(dir, manifest) };\n const parent = UriUtils.dirname(dir);\n if (parent.toString() === dir.toString()) return undefined;\n dir = parent;\n }\n return undefined;\n}\n\n/**\n * What each environment holds once the dotenv files are folded in.\n *\n * The editor has to show what a run would see, and a run reads `.env` as well\n * as `venn.toml`. `dotenvFiles` is the same list the runner walks, so the two\n * cannot disagree about where a value lives. Only the environment the process\n * was started with is left out: that belongs to whoever launches the program,\n * not to the file being edited.\n */\nfunction withDotenv(dir: URI, manifest: Manifested0): Record<string, Record<string, string>> {\n const names = new Set([...Object.keys(manifest.env), \"local\"]);\n const out: Record<string, Record<string, string>> = {};\n for (const name of names) {\n out[name] = { ...(manifest.env[name] ?? {}), ...readDotenv(dir, manifest.files, name) };\n }\n return out;\n}\n\nfunction readDotenv(dir: URI, configured: readonly string[], name: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const file of dotenvFiles({ configured, name })) {\n const content = readText(UriUtils.resolvePath(dir, file));\n if (content !== undefined) Object.assign(out, parseDotenv(content));\n }\n return out;\n}\n\nfunction readText(uri: URI): string | undefined {\n try {\n return readFileSync(uri.fsPath, \"utf8\");\n } catch {\n return undefined;\n }\n}\n\n/** What {@link read} returns, before the dotenv files are folded into it. */\ntype Manifested0 = Omit<Manifested, \"root\"> & { files: readonly string[] };\n\nfunction read(uri: URI): Manifested0 | undefined {\n try {\n const content = readFileSync(uri.fsPath, \"utf8\");\n const manifest = createTomlManifest({ content }).load();\n return {\n paths: manifest.paths,\n format: manifest.format as Record<string, unknown>,\n env: manifest.env,\n files: manifest.envFiles,\n docs: tomlDocs(content),\n };\n } catch {\n return undefined;\n }\n}\n\n/** A scope holds a slash and a file name cannot: `@types/node` becomes `@types__node`. */\nfunction fileName(name: string): string {\n return name.replace(\"/\", \"__\");\n}\n\nfunction readDerived(uri: URI): Record<string, TypeSpec> | undefined {\n try {\n const parsed = JSON.parse(readFileSync(uri.fsPath, \"utf8\")) as {\n exports?: Record<string, TypeSpec>;\n };\n return parsed.exports;\n } catch {\n return undefined;\n }\n}\n","import { VennGeneratedModule, VennGeneratedSharedModule, VennLexer } from \"@venn-lang/core\";\nimport { allPlugins } from \"@venn-lang/stdlib\";\nimport { inject, type Module } from \"langium\";\nimport {\n createDefaultModule,\n createDefaultSharedModule,\n type DefaultSharedModuleContext,\n type LangiumSharedServices,\n type PartialLangiumServices,\n} from \"langium/lsp\";\nimport { buildCatalog } from \"../catalog/index.js\";\nimport { VennCodeActionProvider } from \"../code-actions/index.js\";\nimport { VennCompletionProvider } from \"../completion/index.js\";\nimport { VennDefinitionProvider } from \"../definition/index.js\";\nimport { VennFormatter } from \"../formatting/index.js\";\nimport { VennHoverProvider } from \"../hover/index.js\";\nimport { VennDocumentHighlightProvider, VennReferencesProvider } from \"../references/index.js\";\nimport { VennRenameProvider } from \"../rename/index.js\";\nimport { VennSemanticTokenProvider } from \"../semantic/index.js\";\nimport { VennSignatureHelpProvider } from \"../signature/index.js\";\nimport { VennDocumentSymbolProvider } from \"../symbols/index.js\";\nimport { createTypeService, warmTypes } from \"../types/index.js\";\nimport { registerVennChecks } from \"../validation/index.js\";\nimport { createImportResolver } from \"../workspace/index.js\";\nimport type { VennAddedServices, VennServices } from \"./lsp.types.js\";\n\nconst VennModule: Module<VennServices, PartialLangiumServices & VennAddedServices> = {\n catalog: () => buildCatalog(allPlugins),\n imports: () => createImportResolver(),\n types: (services) => createTypeService(services),\n parser: { Lexer: (services) => new VennLexer(services) },\n lsp: {\n SemanticTokenProvider: (services) => new VennSemanticTokenProvider(services),\n HoverProvider: (services) => new VennHoverProvider(services),\n DefinitionProvider: (services) => new VennDefinitionProvider(services),\n CompletionProvider: (services) => new VennCompletionProvider(services),\n DocumentSymbolProvider: () => new VennDocumentSymbolProvider(),\n RenameProvider: (services) => new VennRenameProvider(services),\n ReferencesProvider: (services) => new VennReferencesProvider(services),\n DocumentHighlightProvider: () => new VennDocumentHighlightProvider(),\n CodeActionProvider: (services) => new VennCodeActionProvider(services),\n SignatureHelp: (services) => new VennSignatureHelpProvider(services),\n Formatter: (services) => new VennFormatter(services),\n },\n};\n\n/**\n * Build the Venn language services on top of Langium's LSP stack. Registering\n * the validator and warming the type cache happen here, so a caller only has to\n * supply a connection and start the server.\n *\n * @param context Langium's shared module context: a connection and a file system.\n * @returns The shared Langium services, and the Venn services built on them.\n */\nexport function createVennLspServices(context: DefaultSharedModuleContext): {\n shared: LangiumSharedServices;\n Venn: VennServices;\n} {\n const shared = inject(createDefaultSharedModule(context), VennGeneratedSharedModule);\n const Venn = inject(createDefaultModule({ shared }), VennGeneratedModule, VennModule);\n shared.ServiceRegistry.register(Venn);\n registerVennChecks(Venn);\n warmTypes(shared, Venn.types);\n return { shared, Venn };\n}\n","import { startLanguageServer } from \"langium/lsp\";\nimport { NodeFileSystem } from \"langium/node\";\nimport type { Connection } from \"vscode-languageserver\";\nimport { createVennLspServices } from \"../services/index.js\";\n\n/**\n * Start the Venn language server on an established connection. This is the one\n * wiring shared by the standalone `venn-lsp` binary and the VS Code extension.\n *\n * @param connection An LSP connection the caller has already created.\n */\nexport function startVennServer(connection: Connection): void {\n const { shared } = createVennLspServices({ connection, ...NodeFileSystem });\n startLanguageServer(shared);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,aAAa,SAAqD;CAChF,MAAM,QAAe;EACnB,yBAAS,IAAI,IAAI;EACjB,0BAAU,IAAI,IAAI;EAClB,6BAAa,IAAI,IAAI;EACrB,kCAAkB,IAAI,IAAI;EAC1B,0BAAU,IAAI,IAAI;CACpB;CACA,KAAK,MAAM,UAAU,SAAS,UAAU,QAAQ,KAAK;CACrD,OAAO,KAAK,OAAO,OAAO;AAC5B;AAEA,SAAS,KAAK,OAAc,SAAqD;CAC/E,OAAO;EACL,kBAAkB,CAAC,GAAG,MAAM,YAAY,KAAK,CAAC;EAC9C,gBAAgB,QAAQ,KAAK,WAAW,OAAO,IAAI;EACnD,eAAe,cAAc,MAAM,YAAY,IAAI,SAAS;EAC5D,YAAY,cAAc,MAAM,YAAY,IAAI,SAAS,KAAK,CAAC;EAC/D,SAAS,WAAW,SAAS,MAAM,QAAQ,IAAI,GAAG,UAAU,GAAG,MAAM;EACrE,UAAU,cAAc,MAAM,iBAAiB,IAAI,SAAS,KAAK,CAAC;EAClE,gBAAgB,CAAC,GAAG,MAAM,SAAS,OAAO,CAAC;EAC3C,UAAU,SAAS,MAAM,SAAS,IAAI,IAAI;EAC1C,qBAAqB,QAAQ,MAAM,SAAS,IAAI,GAAG;EACnD,cAAc,cACZ,CA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