Commit Graph

2 Commits

Author SHA1 Message Date
46e3cc4ccd feat(config): add per-repo .pi-lsp.json server overrides
Users can now drop a .pi-lsp.json at any ancestor of their working
files to add new LSP servers, override built-in ones, or disable
servers entirely. The nearest config (walking upward) wins.

- New src/config.ts: walks upward for .pi-lsp.json, parses, and
  merges with the built-in registry. Cached per config-file path
  with mtime invalidation. Falls back to built-ins on parse error.
- Merge rules: matching id shallow-merges (user wins); new id
  appends (must include match/command/args/rootMarkers); `disable`
  filters at the end.
- src/root.ts: pickServer() now resolves servers via the per-repo
  registry. Adds findServerById(filePath, id) and re-exports
  getServersForPath() for callers.
- src/daemon.ts: getOrCreateEntry() resolves serverId against the
  filePath's config so spawned servers reflect repo overrides.
- index.ts and cli.ts: replace direct `servers` imports with
  path-aware getServersForPath() lookups.
- Tests: 9 new unit tests covering merge semantics, walk-up
  discovery, mtime invalidation, and graceful fallback.
- Docs: README "Per-Repo Config" section + AGENTS.md updates.
2026-05-07 22:43:41 -04:00
aa7309b363 test: add unit and integration test suite
Add 34 tests (27 unit, 7 integration) using node:test runner:

Unit tests:
- pickServer(), findRoot(), pathToUri(), uriToPath()
- isLspCommand(), listCommands()
- formatHover(), formatDefinition(), formatReferences(), formatDiagnostics()

Integration tests:
- daemon lifecycle (status/stop) on isolated socket
- CLI --no-daemon queries (hover, documentSymbol, diagnostics)

Supporting changes:
- socketPath() honors PI_LSP_SOCKET_PATH env var for test isolation
- test fixtures for valid and broken TypeScript files
- npm test / test:unit / test:integration scripts
2026-04-30 10:36:54 -04:00