This document outlines the implementation plan for the Blueprint DSL Language Server Protocol (LSP) implementation. The LSP will provide IDE integration for .bp requirement files including syntax highlighting, diagnostics, hover information, navigation, and integration with ticket artifacts.
Tech Stack:
- Language/Runtime: TypeScript/Node
- Package Manager: Bun
- Parser: tree-sitter
- LSP Framework: vscode-languageserver + vscode-languageclient
- Schema Validation: valibot (for JSON files like .tickets.json)
- Testing: Bun
- Bundling: zshy
- Initialize monorepo structure with packages for
server,client, andtree-sitter-blueprint - Configure
package.jsonwith workspaces for monorepo management - Set up TypeScript configuration (
tsconfig.json) for each package - Configure Bun as the package manager and test runner
- Set up zshy bundler configuration for production builds (Configured
packages/blueprint-lsp-server/package.jsonwith zshy entrypoint map and bin field for CLI executable, addedbuild,build:dry-run, andcleanscripts. Updatedtsconfig.jsonto support emit for zshy builds. Added shebang tosrc/index.ts. zshy auto-generatesmain,module,types,exports,bin, andfilesfields. Produces dual ESM/CJS output indist/directory withblueprint-lsp-serverCLI command.) - Create
.gitignorewith appropriate exclusions
- Configure ESLint and Prettier for code quality (Added ESLint 9 with flat config (
eslint.config.js) using typescript-eslint, eslint-plugin-prettier, and eslint-config-prettier. Created.prettierrcwith standard formatting rules and.prettierignore. Addedlint,lint:fix,format, andformat:checkscripts to rootpackage.json. Tree-sitter grammar folder is excluded from linting since it uses special DSL functions.) - Set up VS Code workspace settings for development (Added
.vscode/settings.jsonwith editor settings aligned to .prettierrc, format-on-save with Prettier, ESLint auto-fix on save, TypeScript workspace SDK configuration, file associations for.bpfiles, search exclusions for generated files, and Bun as package manager. Added.vscode/extensions.jsonwith recommended extensions: Prettier, ESLint, TypeScript, Bun, tree-sitter, and JS debugger.) - Create launch configurations for debugging the LSP server and client (Added
.vscode/launch.jsonwith configurations for: "Launch Extension" using extensionHost, "Attach to LSP Server" on port 6009, "Debug LSP Server (Standalone)" with Bun, "Debug Current Test File", "Debug All LSP Server Tests", and compound "Extension + Server" configuration. Also added.vscode/tasks.jsonwith build, watch, and test tasks.) - Set up hot-reload for development iteration (Added npm scripts to
packages/blueprint-lsp-server/package.json:devusesbun --watch,dev:debugadds inspector,test:watchfor continuous testing,typecheck:watchfor continuous type checking. Updated.vscode/tasks.jsonwithwatch-server,watch-server-debug,watch-tests, and compounddevtask that runs both server and typecheck watchers in parallel.)
- Create
tree-sitter-blueprintpackage directory structure - Define
grammar.jswith lexical rules:- UTF-8 character set handling
- Line ending normalization (LF/CRLF)
- Single-line comments (
// ...) - Multi-line comments (
/* ... */) - Identifier pattern:
[a-zA-Z_][a-zA-Z0-9_-]* - Whitespace and indentation handling
- Define
@descriptionkeyword and block parsing - Implement description-text capture (free-form prose until next keyword)
- Define
@modulerule with identifier and description-text - Define
@featurerule with identifier and description-text - Define
@requirementrule with identifier and description-text - Implement proper nesting validation (features in modules, requirements in features)
- Define
@depends-onrule with comma-separated reference list - Implement reference parsing (dot-notation:
module.feature.requirement) - Define
@constraintrule with identifier and description-text
- Parse free-form prose text
- Handle fenced code blocks (
...) - Preserve paragraph separation (blank lines)
- Write corpus tests for valid syntax cases
- Write corpus tests for edge cases (empty files, minimal documents)
- Write corpus tests for error recovery scenarios
- Generate and compile the tree-sitter parser
Note: The LSP server will use web-tree-sitter (WASM bindings) instead of native Node.js bindings.
WASM is the standard approach for tree-sitter LSP servers (e.g., bash-language-server) because it's
easier to distribute and works across all platforms without native compilation. The existing
tree-sitter build --wasm script generates the required .wasm file.
- Create LSP server entry point using
vscode-languageserver/node - Implement
initializehandler with capability negotiation - Implement
initializedhandler for post-initialization setup - Implement
shutdownandexithandlers - Set up connection and document manager
- Implement
TextDocumentsmanager for open.bpfiles - Handle
textDocument/didOpen- parse and index document - Handle
textDocument/didChange- re-parsing (full sync mode) - Handle
textDocument/didClose- cleanup document state - Handle
textDocument/didSave- trigger full validation
- Integrate tree-sitter parser into server (via web-tree-sitter WASM)
- Create AST node types mirroring Blueprint hierarchy:
-
DescriptionNode -
ModuleNode -
FeatureNode -
RequirementNode -
DependsOnNode -
ConstraintNode
-
- Implement tree-sitter to AST transformation
- Build source location tracking for all nodes
- Create document symbol table (identifier → node mapping)
- Implement workspace folder scanning for
.bpfiles (AddedWorkspaceManagerclass inworkspace.tswith recursive directory scanning, hidden directory filtering, and workspace folder change handling. 26 tests added inworkspace.test.ts.) - Build cross-file symbol index (Added
CrossFileSymbolIndexclass insymbol-index.tswith global symbol registry, cross-file reference resolution, dependency tracking, and conflict detection. Integrated withWorkspaceManagerfile discovery and document lifecycle events inindex.ts. 37 tests added insymbol-index.test.ts.) - Implement file watcher for
.bpfile changes (Added**/*.bpglob pattern toDidChangeWatchedFilesNotificationregistration inonInitialized. Handler inonDidChangeWatchedFilesprocesses Created/Changed/Deleted events: Created adds toWorkspaceManagerand indexes file, Changed re-indexes if file not open in editor, Deleted removes fromWorkspaceManagerandCrossFileSymbolIndex.) - Handle workspace folder additions/removals (Implemented in
WorkspaceManager.handleWorkspaceFoldersChange())
- Implement ticket file path resolution (
requirements/foo.bp→.blueprint/tickets/foo.tickets.json) (Completed: Addedtickets.tsmodule withresolveTicketFilePath(),resolveTicketFileUri(),ticketFileExists(),resolveBpFileBaseName(),getTicketFileName(),isTicketFilePath(), andisBlueprintFilePath()functions. Supports configurable tickets path via parameter. 27 tests added intickets.test.ts.) - Handle configurable tickets path from settings (Completed: All ticket path functions accept an optional
ticketsPathparameter that defaults to.blueprint/ticketsper SPEC.md Section 5.9.) - Set up file watcher for
.tickets.jsonchanges (Completed: AddedDidChangeWatchedFilesNotificationregistration inonInitializedfor**/.blueprint/tickets/*.tickets.jsonglob pattern. Addedconnection.onDidChangeWatchedFileshandler that processesCreated,Changed, andDeletedevents, reading file content and updatingTicketDocumentManagerstate accordingly.)
- Define TypeScript interfaces for ticket schema (Completed: Using valibot schemas in
tickets.tswith types inferred viav.InferOutput<>. Full SPEC.md Section 4 compliance):-
TicketFileSchema/TicketFile(version, source, tickets array) -
TicketSchema/Ticket(id, ref, description, status, constraints_satisfied, implementation) -
TicketImplementationSchema/TicketImplementation(files, tests) -
TicketStatusSchema/TicketStatus(pending, in-progress, complete, obsolete)
-
- Implement JSON schema validation for ticket files (Completed: Using valibot's
v.safeParse()with custom error formatting. AddedvalidateTicketFile(),parseTicketFileContent(), andparseTicketFile()functions. Includes duplicate ticket ID detection. 40 new tests intickets.test.ts.) - Report schema validation errors as diagnostics (Completed: Added
TicketDocumentManagerclass inticket-documents.tsthat validates.tickets.jsonfiles and publishes diagnostics. Integrated with LSP server document lifecycle events inindex.ts. Reports errors for invalid JSON, schema violations, and duplicate ticket IDs. Version mismatches are reported as warnings. 24 tests added inticket-documents.test.ts.)
- Build mapping from requirement refs to tickets (Completed: Added
requirement-ticket-map.tsmodule withbuildRequirementTicketMap()andbuildRequirementTicketMapFromSymbols()functions. 40 tests added inrequirement-ticket-map.test.ts.) - Handle one-to-many requirement-to-ticket relationships (Completed:
groupTicketsByRef()groups tickets by their ref,RequirementTicketInfostores array of tickets per requirement.) - Aggregate constraint satisfaction across tickets sharing same ref (Completed:
computeConstraintStatuses()aggregatesconstraints_satisfiedfrom all tickets, tracks which ticket IDs satisfy each constraint.) - Compute requirement completion status (Completed:
computeRequirementStatus()computes aggregated status,getCompletionSummary()provides module/feature-level progress stats,filterByPathPrefix()enables scoped queries.)
- Parse dot-notation references (
module.feature.requirement) (Completed:ReferenceNodeinast.tsstorespartsarray andpathstring.transformReference()extracts parts from tree-sitter nodes.) - Resolve references to target nodes (same file) (Completed:
CrossFileSymbolIndex.resolveReference()insymbol-index.tsresolves references toIndexedSymbolobjects.) - Resolve cross-file references (Completed:
CrossFileSymbolIndexmaintains global symbol registry across all indexed files, enabling cross-file resolution.) - Handle partial references (module-only, module.feature) (Completed:
resolveReference()supports both exact and partial matching via prefix search inglobalSymbols.)
- Build directed dependency graph from
@depends-ondeclarations (Completed: AddedDependencyGraphclass independency-graph.tswithbuild()static method that constructs graph fromCrossFileSymbolIndex. 27 tests independency-graph.test.ts.) - Implement topological sort for dependency ordering (Completed:
topologicalSort()uses Kahn's algorithm to produce ordering where dependencies come before dependents.) - Detect circular dependencies using cycle detection algorithm (Completed:
detectCycles()uses DFS-based cycle detection, returnsCircularDependency[]with cycle paths and edges.) - Compute transitive dependencies (Completed:
getTransitiveDependencies()andgetTransitiveDependents()methods compute transitive closures.)
- Determine if a requirement is blocked by incomplete dependencies (Completed: Added
blocking-status.tsmodule withcomputeBlockingInfo()that checks direct and transitive dependencies against ticket status. ReturnsBlockingInfowith status (not-blocked,blocked,in-cycle) and lists ofBlockerInfoobjects. 27 tests added inblocking-status.test.ts.) - Propagate blocking status through hierarchy (Completed:
propagateBlockingToHierarchy()aggregates blocking status from requirements up to features and modules. In-cycle status takes precedence over blocked.) - Cache and invalidate blocking status on changes (Completed: Added
BlockingStatusCachetype withcreateBlockingStatusCache(),invalidateBlockingStatusCache(),updateBlockingStatusCache(), andshouldInvalidateCache()functions for cache management.)
- Report tree-sitter parse errors as diagnostics (Completed:
DocumentManager.collectErrorNodes()indocuments.tsrecursively scans tree-sitter parse trees for ERROR and MISSING nodes.) - Provide meaningful error messages for common syntax mistakes (Completed: Added context-aware error messages in
documents.tsviagetMissingNodeMessage(),getErrorNodeMessage(), andgetContextualErrorMessage()methods. Handles orphaned elements at wrong scope, invalid identifiers starting with digits, missing identifiers after keywords, and reference-related errors. 8 new tests added indocuments.test.ts.) - Include source location (line, column, range) (Completed: Error diagnostics include full range from
node.startPositiontonode.endPosition.)
- Detect circular dependencies (Error) (Completed: Added
workspace-diagnostics.tsmodule withcomputeCircularDependencyDiagnostics()function that usesDependencyGraph.build()to detect cycles and generates diagnostics at each@depends-onlocation in the cycle. Diagnostics include the full cycle path in the error message. Integrated with LSP server inindex.tsviapublishWorkspaceDiagnostics()which is called after symbol index updates. 20 tests added inworkspace-diagnostics.test.ts.) - Detect references to non-existent requirements (Error) (Completed: Added
computeUnresolvedReferenceDiagnostics()inworkspace-diagnostics.tsthat usesCrossFileSymbolIndex.getUnresolvedReferences()to find all unresolved@depends-onreferences and generates diagnostics with the unresolved path in the error message. Tests added inworkspace-diagnostics.test.ts.) - Detect duplicate identifiers in scope (Error) (Completed:
buildSymbolTable()inast.tsreturns duplicates,validateDuplicateIdentifiers()indocuments.tscreates diagnostics. Tests inast.test.tsanddocuments.test.ts.) - Detect multiple
@descriptionblocks in one file (Error) - Detect
@descriptionafter@module(Error)
- Warn when requirement has no ticket (Completed: Added
computeNoTicketDiagnostics()inworkspace-diagnostics.tsthat compares requirements fromCrossFileSymbolIndexagainst tickets. Integrated withcomputeWorkspaceDiagnostics()which now accepts optional tickets array. UpdatedpublishWorkspaceDiagnostics()inindex.tsto pass tickets fromTicketDocumentManager.getAllTickets(). AddedgetAllTicketFiles()andgetAllTickets()methods toTicketDocumentManager. 11 new tests inworkspace-diagnostics.test.ts.) - Warn when ticket references removed requirement (Completed: Added
computeOrphanedTicketDiagnostics()inworkspace-diagnostics.tsthat checks ticket refs against valid requirement paths fromCrossFileSymbolIndex. Diagnostics are reported on.tickets.jsonfiles with codeorphaned-ticket. Integrated withpublishWorkspaceDiagnostics()inindex.tsto merge with ticket document diagnostics. 10 new tests inworkspace-diagnostics.test.ts.) - Warn on constraint identifier mismatch between
.bpand ticket (Completed: AddedcomputeConstraintMismatchDiagnostics()inworkspace-diagnostics.tsthat checks if ticketconstraints_satisfiedarrays contain constraint identifiers not defined in the corresponding requirement's@constraintlist. Diagnostics are reported on.tickets.jsonfiles with codeconstraint-mismatch. Integrated withpublishWorkspaceDiagnostics()inindex.tsusingmergeDiagnosticResults()to combine with orphaned ticket diagnostics. 12 new tests inworkspace-diagnostics.test.ts.)
- Info diagnostic when requirement is blocked by pending dependencies
- Implement debounced diagnostic publishing (Completed: Added
scheduleWorkspaceDiagnostics()function with 150ms debounce delay inindex.ts. UsessetTimeout/clearTimeoutpattern to batch rapid changes. Timer is cancelled on shutdown to prevent callbacks after cleanup.) - Clear diagnostics when document is closed (Already implemented:
DocumentManager.onDocumentClose()indocuments.ts:65andTicketDocumentManager.onDocumentClose()inticket-documents.ts:65both callconnection.sendDiagnostics({ uri, diagnostics: [] })to clear diagnostics when documents are closed.) - Update diagnostics on ticket file changes (Completed: Added
scheduleWorkspaceDiagnostics()calls to all ticket file lifecycle handlers inindex.ts:onDidOpen,onDidChangeContent,onDidSavefor open documents, andonDidChangeWatchedFilesfor file system changes. This ensures workspace diagnostics like no-ticket warnings and blocked requirement info are updated when ticket status changes.)
- Register semantic token types (Completed: Added
semantic-tokens.tsmodule withsemanticTokensLegenddefining token types and modifiers. Integrated with LSP server inindex.tsviasemanticTokensProvidercapability. 18 tests added insemantic-tokens.test.ts.):-
keyword(for @description, @module, @feature, @requirement, @depends-on, @constraint) -
variable(for identifiers) -
type(for references) -
comment(for comments)
-
- Register semantic token modifiers (declaration, definition)
- Implement
textDocument/semanticTokens/fullhandler (Completed: Addedconnection.languages.semanticTokens.on()handler inindex.tsthat callsbuildSemanticTokens()fromsemantic-tokens.ts.) - Walk AST and emit tokens for each element (Completed:
walkTree()andprocessNode()functions recursively traverse the tree-sitter parse tree.) - Handle token encoding (delta line, delta column, length, type, modifiers) (Completed: Uses
SemanticTokensBuilderfrom vscode-languageserver with proper sorting of tokens before building.)
- Emit tokens with status-based modifiers for requirements (Completed: Added status-based token modifiers
noTicket,blocked,inProgress,complete,obsoletetosemanticTokensLegend. UpdatedbuildSemanticTokens()to accept optionalstatusMapparameter. AddedbuildRequirementStatusMap()to combine ticket status and blocking status. Status modifiers are applied to both@requirementkeywords and requirement identifier tokens. 13 new tests added insemantic-tokens.test.ts.):- No ticket → noTicket modifier (dim styling)
- pending → no modifier (default styling)
- blocked → blocked modifier (error styling)
- in-progress → inProgress modifier (warning styling)
- complete → complete modifier (success styling)
- obsolete → obsolete modifier (strikethrough styling)
- Implement
textDocument/hoverhandler (Completed: Addedhover.tsmodule withfindHoverTarget()andbuildHover()functions. Integrated with LSP server inindex.tsviaconnection.onHover()handler. AddedhoverProvider: trueto server capabilities.) - Determine hovered element from position (Completed:
findNodeAtPosition()uses tree-sitter to find the deepest node at cursor position.findHoverTarget()walks up the tree to identify module, feature, requirement, constraint, reference, or keyword targets.)
- Display ticket ID(s) associated with requirement (Completed:
buildRequirementHover()shows all tickets associated with a requirement, including ticket ID and description.) - Display aggregated status across all tickets (Completed: Shows aggregated status computed by
RequirementTicketMap- complete, in-progress, pending, no-ticket, or obsolete.) - Display constraint satisfaction (X/Y satisfied with checkmarks) (Completed: Shows "X/Y satisfied" with checkmark or empty circle icons for each constraint. Uses
computeConstraintStatuses()from requirement-ticket-map.) - Display computed dependency status (resolved by LSP) (Completed: Shows blocking info computed by
computeBlockingInfo()- displays direct and transitive blockers with their statuses, or cycle information if in a circular dependency.) - Display implementation files from tickets (Completed: Shows implementation files and test files from ticket data.)
- Compute aggregate progress (X/Y requirements complete) (Completed:
buildFeatureHover()andbuildModuleHover()usegetCompletionSummary()andfilterByPathPrefix()to compute progress.) - Display progress bar visualization (Completed:
buildProgressBar()creates a text-based progress bar with filled/empty blocks.) - List requirements with their individual statuses (Completed: Feature hover lists direct child requirements with status icons. Module hover shows status breakdown and features list.)
- Show blocked requirements with blocking reason (Completed: Requirements in feature list show "blocked" or "in cycle" suffix when applicable.)
- Show preview of referenced element's description (Completed:
buildReferenceHover()shows the resolved symbol's kind and path, with status/progress info for requirements and features/modules.) - Display reference target's status (Completed: Shows ticket status for requirements, progress for features/modules, or "Unresolved reference" warning if not found.)
Note: 29 tests added in hover.test.ts covering all hover functionality including requirement, feature, module, constraint, reference, and keyword hovers, as well as blocking status and multiple tickets per requirement.
- Implement
textDocument/definitionhandler (Completed: Addeddefinition.tsmodule withfindDefinitionTarget()andbuildDefinition()functions. Integrated with LSP server inindex.tsviaconnection.onDefinition()handler. AddeddefinitionProvider: trueto server capabilities. 17 tests added indefinition.test.ts.) - Requirement identifier → ticket in
.tickets.json(Completed:buildRequirementDefinition()navigates to ticket position in JSON file when tickets exist, falls back to symbol definition otherwise. Supports multiple tickets returningLocation[].) -
@depends-onreference → referenced requirement (Completed:buildReferenceDefinition()resolves cross-file references viaCrossFileSymbolIndexand returns location of the referenced symbol.) - Constraint identifier → constraint definition (Completed:
buildSymbolDefinition()returns the constraint's source location.) - File path in hover → source file (Completed: Added
formatFileLink()helper inhover.tsthat converts relative file paths to clickable Markdown links withfile://URIs. UpdatedbuildRequirementHover()to render implementation files and test files as clickable links when workspace folders are available. AddedgetWorkspaceFolderUris()method toWorkspaceManager. Hover context now includesworkspaceFolderUrisfor path resolution. 11 new tests inhover.test.ts, 4 new tests inworkspace.test.ts.)
- Implement
textDocument/referenceshandler (Completed: Addedreferences.tsmodule withfindReferencesTarget()andbuildReferences()functions. UsesDependencyGraph.edgesto find all@depends-ondeclarations that reference a symbol. Integrated with LSP server inindex.tsviaconnection.onReferences()handler. AddedreferencesProvider: trueto server capabilities. 21 tests added inreferences.test.ts.) - Find all
@depends-ondeclarations referencing an element (Completed:findReferencingEdges()searches dependency graph edges for exact matches and parent references that implicitly include children.) - Find tickets tracking a requirement (Completed: Extended
ReferencesContextto include optionalticketMapandticketFilesfields. AddedfindTicketReferences()function inreferences.tsthat finds all tickets tracking a requirement and returns their locations in.tickets.jsonfiles. UpdatedbuildReferences()to include ticket locations for requirement targets. Updatedindex.tsto pass ticket context to references handler. 7 new tests added inreferences.test.tscovering single ticket, multiple tickets, combined @depends-on and ticket references, includeDeclaration behavior, and backward compatibility.) - Find source files implementing a requirement (via ticket data) (Completed: Added
findImplementationFileReferences()function inreferences.tsthat readsimplementation.filesandimplementation.testsarrays from tickets and converts relative paths to absolute file URIs using workspace folder. AddedworkspaceFolderUristoReferencesContext. UpdatedbuildReferences()to include implementation file locations for requirement targets. Updatedindex.tsto pass workspace folder URIs to references handler. 7 new tests added inreferences.test.tscovering single/multiple tickets, deduplication, missing workspace folders, missing implementation field, and combined reference types.)
- Implement
textDocument/documentSymbolhandler (Completed: Addeddocument-symbol.tsmodule withbuildDocumentSymbols()function. Integrated with LSP server inindex.tsviaconnection.onDocumentSymbol()handler. AddeddocumentSymbolProvider: trueto server capabilities. 26 tests added indocument-symbol.test.ts.) - Return hierarchical symbol tree (modules → features → requirements) (Completed:
buildModuleSymbol(),buildFeatureSymbol(),buildRequirementSymbol()functions build nestedDocumentSymbolhierarchy.) - Include constraints as children of requirements (Completed:
buildConstraintSymbol()createsDocumentSymbolfor constraints, included as children at module, feature, and requirement levels.)
- Implement
workspace/symbolhandler (Completed: Addedworkspace-symbol.tsmodule withbuildWorkspaceSymbols()function. Integrated with LSP server inindex.tsviaconnection.onWorkspaceSymbol()handler. AddedworkspaceSymbolProvider: trueto server capabilities. 26 tests added inworkspace-symbol.test.ts.) - Enable searching across all
.bpfiles in workspace (Completed: UsesCrossFileSymbolIndexto search across all indexed files. Supports prefix matching, substring matching, and fuzzy matching. Results are sorted by relevance with configurable max results.)
- Suggest creating ticket for requirement without ticket (Completed: Added
code-actions.tsmodule withbuildCodeActions()function. Handles "no-ticket" diagnostics by generating code actions that create tickets in existing or new.tickets.jsonfiles. Includes ticket ID generation, workspace folder resolution, and both edit types (add to existing file, create new file). RegisteredcodeActionProvidercapability andonCodeActionhandler inindex.ts. 31 tests added incode-actions.test.ts.) - Suggest fixing typos in references (did-you-mean) (Completed: Added
levenshteinDistance(),stringSimilarity(),findSimilarSymbols(), andextractUnresolvedReferenceFromMessage()functions incode-actions.ts. Handler for "unresolved-reference" diagnostics generates code actions with title "Did you mean 'X'?" that replace the typo with the correct reference. Uses Levenshtein distance with multiple similarity strategies (full path, per-part, suffix, and last-part matching). 34 new tests added incode-actions.test.tscovering Levenshtein distance, string similarity, message extraction, similar symbol finding, and code action generation.) - Suggest removing obsolete ticket references (Completed: Extended
code-actions.tswithextractOrphanedTicketInfo()to parse "orphaned-ticket" diagnostic messages andcreateRemoveTicketEdit()to generate edits that remove tickets from.tickets.jsonfiles. Handles comma removal for proper JSON formatting. Added handling for "orphaned-ticket" diagnostics inbuildCodeActions(). 18 new tests added incode-actions.test.ts.)
- "Show all dependencies" action (Completed: Added
findSymbolAtPosition(),buildDependencyCodeActions(), andgetDependencyLocations()functions incode-actions.ts. When cursor is on a module, feature, or requirement that has dependencies, a source code action "Show N dependencies of 'path'" appears. The action includes a command with locations array for the client to display. UpdatedCodeActionsContextto includedependencyGraphandtree. Updatedindex.tsto build dependency graph and pass parse tree to code actions handler. 13 new tests added incode-actions.test.ts.) - "Show all dependents" action (Completed: Implemented alongside "Show all dependencies" in the same commit. When a symbol has dependents, a source code action "Show N dependents of 'path'" appears with locations of symbols that depend on the current one. Uses
blueprint.showLocationscommand for client-side handling.)
- Create VS Code extension package structure (Created
packages/blueprint-lsp-client/with proper VS Code extension layout includingsrc/,syntaxes/, and configuration files.) - Define
package.jsonwith extension manifest (Configured withengines.vscode,activationEvents,mainentry point,contributes.languages,contributes.grammars,contributes.configurationforblueprint.ticketsPathandblueprint.trace.serversettings, and dependencies onvscode-languageclient.) - Configure extension activation events (
.bpfiles) (SetactivationEvents: ["onLanguage:blueprint"]and registered.bpfile extension withblueprintlanguage ID.) - Set up language configuration for Blueprint (Created
language-configuration.jsonwith comment toggling, bracket pairs, auto-closing, surrounding pairs, folding markers, word pattern, and indentation rules.)
- Initialize
LanguageClientwith server options (Createdsrc/extension.tswithLanguageClientinitialization usingTransportKind.ipc.) - Configure server module path and debug options (Configured server module path to
../blueprint-lsp-server/dist/index.cjswith debug options for--inspect=6009.) - Set document selector for
.bpfiles (Set document selector to{ scheme: "file", language: "blueprint" }.) - Handle client lifecycle (start, stop, restart) (Implemented
activate()anddeactivate()functions with proper client start/stop handling.)
- Define bracket pairs and auto-closing (Configured in
language-configuration.jsonwith(),[],{}pairs and auto-closing for quotes and block comments.) - Configure comment toggling (
//and/* */) (SetlineComment: "//"andblockComment: ["/*", "*/"]inlanguage-configuration.json.) - Set up word pattern for identifiers (Set
wordPattern: "[a-zA-Z_][a-zA-Z0-9_-]*"matching SPEC.md identifier rules.) - Configure indentation rules (Set
increaseIndentPatternanddecreaseIndentPatternfor Blueprint keywords.)
- Create
.tmLanguage.jsonfor basic syntax highlighting (Createdsyntaxes/blueprint.tmLanguage.jsonwith TextMate grammar.) - Define scopes for keywords, identifiers, comments (Defined scopes:
keyword.control.*for hierarchy keywords,keyword.other.*for annotations,entity.name.type.*for identifiers,comment.*for comments,string.*for strings, andmarkup.fenced_code.*for code blocks.) - Register grammar with VS Code (Registered in
package.jsoncontributes.grammars withscopeName: "source.blueprint")
- Implement
blueprint.ticketsPathsetting (Added configuration retrieval in LSP server viaconnection.workspace.getConfiguration("blueprint"). StoresticketsPathin module-levelconfiguredTicketsPathvariable with default fromDEFAULT_TICKETS_PATH. AddedonDidChangeConfigurationhandler to update setting dynamically. PassticketsPaththroughCodeActionsContexttoresolveTicketFileUri()for ticket file creation. Configuration is fetched ononInitializedand whenever settings change. Note: File watcher glob patterns are registered once at initialization, so changingticketsPathat runtime requires extension reload for full file watching support.) - Implement highlighting color customization settings (Added
blueprint.highlighting.complete,blueprint.highlighting.inProgress,blueprint.highlighting.blocked,blueprint.highlighting.noTicket, andblueprint.highlighting.obsoleteconfiguration settings inpackages/blueprint-lsp-client/package.jsonwith default colors per SPEC.md Section 5.9. Registered custom semantic token modifiers (noTicket,blocked,inProgress,complete,obsolete) viasemanticTokenModifierscontribution. AddedsemanticTokenScopesto map modifiers to TextMate scopes for fallback highlighting. SetconfigurationDefaultsforeditor.semanticTokenColorCustomizationswith default color rules for each status. AddedupdateSemanticTokenColors()function inextension.tsthat reads user's color settings and applies them to semantic token customizations. Configuration changes are listened to viaonDidChangeConfigurationfor dynamic updates.) - Implement
blueprint.gotoModifiersetting (Addedblueprint.gotoModifierconfiguration setting inpackages/blueprint-lsp-client/package.jsonwith enum values"alt"and"ctrlCmd"per SPEC.md Section 5.9. Default is"alt"meaning Alt+Click triggers go-to-definition. AddedconfigurationDefaultsfor[blueprint]language to seteditor.multiCursorModifierto"ctrlCmd"by default, which makes Ctrl/Cmd+Click add multiple cursors while Alt+Click does go-to-definition. AddedupdateGotoModifier()function inextension.tsthat syncs the Blueprint-specific setting to VS Code's language-specificeditor.multiCursorModifiersetting. Configuration changes are listened to viaonDidChangeConfigurationfor dynamic updates. Note: VS Code'smultiCursorModifieris the inverse ofgotoModifier- it specifies which key adds cursors, and go-to-definition automatically uses the other key.) - Implement
blueprint.showProgressInGuttersetting (Completed: Addedblueprint.showProgressInGutterboolean configuration setting inpackages/blueprint-lsp-client/package.jsonwith defaulttrue. Created SVG gutter icons inpackages/blueprint-lsp-client/icons/for each requirement status:complete.svg(green checkmark),in-progress.svg(amber spinner),blocked.svg(red X),no-ticket.svg(gray dashed circle),obsolete.svg(gray minus),pending.svg(gray circle). Added custom LSP requestblueprint/requirementStatusesin serverindex.tsthat returns requirement positions and statuses for a document. ImplementedcreateGutterDecorationTypes(),updateGutterDecorations(),scheduleGutterUpdate(), andclearAllGutterDecorations()functions inextension.ts. Gutter decorations update on document changes, visible editor changes, and file saves. Setting can be toggled dynamically viaupdateGutterIconsEnabled()which creates/disposes decoration types as needed.) - Implement
blueprint.hoverDelaysetting (Completed: Addedblueprint.hoverDelayconfiguration setting inpackages/blueprint-lsp-client/package.jsonwith typenumber, default300, minimum0, maximum10000, andlanguage-overridablescope. Addededitor.hover.delay: 300toconfigurationDefaultsfor[blueprint]language. AddedupdateHoverDelay()function inextension.tsthat syncs the Blueprint-specific setting to VS Code's language-specificeditor.hover.delaysetting. Configuration changes are listened to viaonDidChangeConfigurationfor dynamic updates.)
- Create decoration types for each status (Completed: Added
createBackgroundDecorationTypes()function that createsTextEditorDecorationTypewith background colors for each requirement status per SPEC.md Section 5.4. Default colors use low opacity (0.15) for subtle highlighting. AddeddisposeBackgroundDecorationTypes()andclearAllBackgroundDecorations()for cleanup.) - Apply decorations based on semantic tokens (Completed: Refactored
updateGutterDecorations()toupdateDecorations()which now applies both gutter icons and background decorations. Background decorations useisWholeLine: trueto highlight the entire requirement line.) - Update decorations on document/ticket changes (Completed: Updated event handlers for
onDidChangeVisibleTextEditors,onDidChangeTextDocument, andonDidSaveTextDocumentto trigger decoration updates when either gutter or background decorations are enabled. Addedblueprint.showProgressHighlightingconfiguration setting to enable/disable the feature.)
- Create icons for completion status (checkmark, progress, blocked) (Completed: SVG icons created in
packages/blueprint-lsp-client/icons/for all 6 statuses:complete.svg,in-progress.svg,blocked.svg,no-ticket.svg,obsolete.svg,pending.svg.) - Apply gutter decorations based on requirement status (Completed:
createGutterDecorationTypes()andupdateDecorations()inextension.tsapply gutter icons based on requirement status from server'sblueprint/requirementStatusesrequest.) - Make gutter icons configurable (Completed:
blueprint.showProgressInGuttersetting controls gutter icon display viaupdateGutterIconsEnabled()function.)
- Test tree-sitter grammar with corpus files
- Test AST transformation
- Test dependency graph construction (27 tests in
dependency-graph.test.ts) - Test cycle detection algorithm (Covered in
dependency-graph.test.tsandworkspace-diagnostics.test.ts) - Test ticket file parsing and validation (40 tests in
tickets.test.ts) - Test requirement-ticket correlation (40 tests in
requirement-ticket-map.test.ts) - Test semantic token generation (32 tests in
semantic-tokens.test.tscovering token types, modifiers, progress-based highlighting, andbuildRequirementStatusMap()) - Test hover information (29 tests in
hover.test.tscovering node finding, hover targets, requirement/feature/module/constraint/reference/keyword hovers, blocking status display, and multiple tickets per requirement) - Test go-to-definition (17 tests in
definition.test.tscovering node finding, definition targets for module/feature/requirement/constraint/reference/keyword, cross-file navigation, ticket file navigation, and fallback behavior) - Test find-references (21 tests in
references.test.tscovering node finding, references targets for module/feature/requirement/constraint/reference/keyword, cross-file references, multiple references, includeDeclaration option, and parent reference matching) - Test document symbols (26 tests in
document-symbol.test.tscovering empty documents, single/multiple modules, features, requirements, constraints at all levels, module-level requirements, symbol ranges, hierarchy building, and complex SPEC.md example structure) - Test workspace symbols (26 tests in
workspace-symbol.test.tscovering empty index, single/multi-file index, query matching with prefix/substring/fuzzy, case-insensitive search, result sorting by relevance, result limiting, symbol kind mapping, container names, and edge cases)
- Test LSP initialization handshake (9 tests in
tests/integration/lsp-server.test.tscovering server capabilities, workspace folder support, semantic token legend, text document sync with didOpen/didChange/didClose, hover for modules and requirements, and graceful shutdown. Tests spawn LSP server as subprocess and communicate via stdio using LSP protocol.) - Test document synchronization (Covered in
tests/integration/lsp-server.test.ts- tests didOpen, didChange, didClose notifications and verifies server correctly processes document updates via documentSymbol requests) - Test diagnostic publishing (6 tests in
tests/integration/lsp-server.test.tscovering syntax error diagnostics, unresolved reference diagnostics, no-ticket warnings, circular dependency errors, diagnostics clearing on document close, and diagnostics updating on content changes. Tests verify correct severity levels, diagnostic codes, and message content.) - Test hover information content (Covered in
tests/integration/lsp-server.test.ts- tests hover for @module keyword and requirement identifiers, verifies hover contains expected content) - Test go-to-definition navigation (8 tests in
tests/integration/lsp-server.test.tscovering: @depends-on reference navigation within same file, requirement identifier definition without ticket, constraint identifier definition, keyword returns null, unresolved reference returns null, cross-file reference navigation between storage.bp and auth.bp, feature identifier definition, and module identifier definition. Tests verify correct URI and range.start.line for all navigation targets.) - Test find-references results (8 tests in
tests/integration/lsp-server.test.tscovering: @depends-on references to requirements, includeDeclaration flag behavior, cross-file references between multiple .bp files, references to features, references to modules, null for symbols with no references, null for keyword positions, and references from within @depends-on position.) - Test cross-file reference resolution (Covered in find-references tests: "finds cross-file references" test opens two files and verifies references from storage.bp symbol are found in payments.bp file.)
- Test full VS Code extension activation (17 tests in
packages/blueprint-lsp-client/tests/suite/extension.test.tsusing @vscode/test-electron. Tests cover: extension presence and activation on .bp files, blueprint language registration, comment toggling and bracket matching, all extension settings defaults (ticketsPath, highlighting colors, gotoModifier, showProgressInGutter, showProgressHighlighting, hoverDelay, trace.server), TextMate grammar registration, LSP client features (hover, document symbols, go-to-definition), and file associations. Run withbun run testin the blueprint-lsp-client package.) - Test syntax highlighting appearance (5 tests added to
packages/blueprint-lsp-client/tests/suite/extension.test.tsin the "Syntax Highlighting" suite. Tests cover: semantic tokens legend availability with verification of token types (keyword, variable, type, comment) and status modifiers (noTicket, blocked, inProgress, complete, obsolete) per SPEC.md Sections 5.3 and 5.4, semantic tokens provision for Blueprint files with token count verification, keyword and identifier token type verification, reference tokens in @depends-on declarations, and comment token verification for single-line and multi-line comments. Tests usevscode.provideDocumentSemanticTokensandvscode.provideDocumentSemanticTokensLegendcommands with retry logic for LSP server initialization.) - Test hover popup rendering (8 tests added to
packages/blueprint-lsp-client/tests/suite/extension.test.tsin the "Hover Popup Rendering" suite. Tests cover: hover on @module showing progress information, hover on @feature showing requirements list, hover on @requirement showing status and constraints, hover on @constraint showing satisfaction status, hover on @depends-on reference showing target information, hover on @module keyword showing Blueprint DSL documentation, hover on requirement with dependencies showing blocking info, and hover on unresolved reference showing warning. Tests usewaitForDocumentReadyandretryOperationhelpers for LSP server initialization, andgetHoverTexthelper to extract text content from hover results.) - Test navigation commands (17 tests in
packages/blueprint-lsp-client/tests/suite/extension.test.tsin the "Navigation Commands" suite. Tests cover: go-to-definition for @depends-on references navigating to requirements, features, and modules; go-to-definition for module, feature, requirement, and constraint identifiers; go-to-definition correctly returning empty for keywords; find-references for requirements, features, and modules finding @depends-on declarations; find-references returning empty for unreferenced symbols; workspace symbols search finding symbols by name; and document symbols returning hierarchical structure with proper module/feature/requirement/constraint nesting. Tests usewaitForDocumentReadyandretryOperationhelpers for LSP server initialization. Fixed LSP client to supportuntitledscheme for in-memory test documents. Fixed LSP server to checklanguageIdin addition to file path for Blueprint document detection.) - Test settings application (8 tests added to
packages/blueprint-lsp-client/tests/suite/extension.test.tsin the "Settings Application" suite. Tests cover: gotoModifier setting updating editor.multiCursorModifier for blueprint files, hoverDelay setting updating editor.hover.delay, highlighting color settings updating semantic token customizations, showProgressInGutter setting toggling, showProgressHighlighting setting toggling, ticketsPath setting changes, trace.server setting accepting valid values, and multiple highlighting colors updating together. Tests verify settings are actually applied to VS Code behavior, not just stored. All tests include proper cleanup by resetting settings to defaults in finally blocks.)
- Benchmark parsing large
.bpfiles (Addedpackages/blueprint-lsp-server/benchmarks/parsing.bench.tswith comprehensive benchmarks for tree-sitter parsing, AST transformation, and symbol table construction. Tests small (3KB), medium (39KB), large (320KB), and XLarge (1.3MB) files. Includes scaling analysis showing O(n^1.00) linear performance. Run withbun run benchin the blueprint-lsp-server package.) - Benchmark workspace indexing time (Added
packages/blueprint-lsp-server/benchmarks/workspace-indexing.bench.tswith comprehensive benchmarks for: symbol indexing performance (CrossFileSymbolIndex.addFile), cross-file reference resolution, full pipeline (parse + AST + index), scaling analysis, and file system operations. Tests workspaces from 5 to 100 files. Shows O(n^1.06) scaling for indexing and O(n^0.76) for reference resolution. Run withbun run bench:workspacein the blueprint-lsp-server package.) - Benchmark hover response latency (Added
packages/blueprint-lsp-server/benchmarks/hover.bench.tswith comprehensive benchmarks for: findHoverTarget() performance for different element types, buildHover() performance with full ticket/dependency context, end-to-end hover latency with various file sizes (Small to XLarge), scaling analysis showing O(n^0.14) sub-linear performance, and ticket data impact benchmarks. Run withbun run bench:hoverin the blueprint-lsp-server package.) - Profile memory usage with many open files (Added
packages/blueprint-lsp-server/benchmarks/memory.bench.tswith comprehensive memory profiling for: document parsing memory (50 files with ~206 symbols each), symbol index memory scaling (10-200 files), ticket data memory usage, full LSP state simulation (100 workspace files with 10 open documents), memory scaling analysis, and memory leak detection. Uses RSS-based measurements for reliability. Results show efficient memory usage with linear scaling and no significant memory leaks. Run withbun run bench:memoryin the blueprint-lsp-server package.)
- Write README with installation instructions (Created comprehensive README.md at project root with: overview and key principles, prerequisites and build-from-source instructions for all 3 packages, quick start example showing Blueprint syntax, language syntax reference table, project structure diagram, LSP features list, configuration options table, development commands for testing/linting/benchmarks, monorepo structure table, and link to SPEC.md.)
- Document all configuration options (Moved VS Code extension documentation to
packages/blueprint-lsp-client/README.md. Root README now references subpackage. Extension README includes: categorized settings tables (General, Progress Visualization, Highlighting Colors, Debugging), keyboard shortcuts table, type information for each setting, detailed descriptions, complete JSON example. Documents all 12 configuration options.) - Create usage guide with screenshots
- Document keyboard shortcuts (Expanded VS Code extension README with comprehensive keyboard shortcuts documentation including: Navigation (Go to Definition, Peek Definition, Find References, Go Back/Forward), Symbols & Search (Document Symbols, Workspace Symbols), Hover & Information, Code Actions & Quick Fixes, Comments, and Folding. Added platform-specific shortcuts for Windows/Linux and macOS. Included cross-editor keybindings table per SPEC.md Section 8.4. Added notes about configurable
blueprint.gotoModifierandblueprint.hoverDelaysettings.)
- Document architecture and code organization
- Document AST node types and properties
- Document contribution guidelines
- Document release process
- Add extension icon and branding
- Write extension marketplace description
- Create demo GIF/video
- Review and improve error messages (Improved 40+ error messages across documents.ts, workspace-diagnostics.ts, tickets.ts, and ticket-documents.ts: added consistent capitalization and punctuation, added actionable hints and examples to missing identifier errors, improved orphaned element messages with guidance on proper structure, enhanced reference errors with dot notation examples, made ticket validation errors more descriptive with required field hints, changed "unknown schema version" to more accurate "Unsupported schema version" wording, and added suggestions for resolving each type of error.)
- Create
.vscodeignorefor extension (Created comprehensive.vscodeignorethat excludes source files, tests, source maps, type declarations, and development artifacts. Addedpackageandpackage:lsscripts topackage.jsonusing--no-dependenciesflag to properly handle monorepo workspace. The extension package includes only:package.json,README.md,language-configuration.json,syntaxes/blueprint.tmLanguage.json,out/extension.js,out/index.js, andicons/*.svg.) - Package extension with
vsce package(Configured complete packaging pipeline: Addedrepository,homepage,bugsfields to package.json. Created MIT LICENSE file. Addedbundle-serverscript usingbun buildto bundle LSP server with all dependencies into singleout/server/index.jsfile (681KB). Copiestree-sitter-blueprint.wasmtoout/server/. Updated extension.ts to search for server in multiple locations:out/server/for distribution,node_modules/for dependency install, and../blueprint-lsp-server/for monorepo development. Final.vsixpackage is 133KB containing 17 files. Runbun run packageto generateblueprint-lsp-client-0.1.0.vsix.) - Test extension installation from
.vsix(Verified complete installation/uninstallation workflow via VS Code CLI:code --install-extension,code --uninstall-extension,code --list-extensions. Extensionblueprint.blueprint-lsp-client@0.1.0installs correctly from the 24MB .vsix package containing 16 files including the bundled LSP server executable and tree-sitter WASM file.)
- Set up CI/CD pipeline for automated builds
- Configure automated testing in CI
- Publish to VS Code Marketplace
- Create GitHub releases with changelog
- Start with Phase 1-2: Get project structure and parser working
- Phase 3.1-3.3: Basic LSP server with document management
- Phase 6.1: Syntax error diagnostics (validates parser integration)
- Phase 7: Semantic tokens for visible progress
- Phase 11.1-11.4: Basic VS Code extension to test above features
- Phase 3.4 + 4: Workspace indexing and ticket integration
- Phase 5: Dependency resolution
- Phase 6.2-6.5: Full diagnostics
- Phase 8-9: Hover and navigation
- Phase 10-11.5-11.7: Advanced features
- Phase 12-14: Testing, documentation, packaging
- The LSP is the source of truth for computed data (dependencies, blocking status, aggregate progress)
- Tickets are intentionally minimal; avoid storing derived data
- Cross-file operations require workspace-wide indexing
- Debounce expensive operations (parsing, diagnostics) for performance
- Consider WASM tree-sitter for browser-based editors in future