Skip to content

feat(lsp): add Dart Language Server support#9

Merged
amondnet merged 7 commits into
mainfrom
8-featlsp-add-dart-language-server-support
Dec 17, 2025
Merged

feat(lsp): add Dart Language Server support#9
amondnet merged 7 commits into
mainfrom
8-featlsp-add-dart-language-server-support

Conversation

@amondnet

Copy link
Copy Markdown
Contributor

Summary

Add Dart Language Server support to packages/lsp with system-first fallback and auto-download capability.

Key Features

  • System-first fallback: Checks for dart in PATH first
  • Auto-download: Downloads Dart SDK 3.7.1 if not found
  • Multi-platform support: linux-x64, linux-arm64, osx-x64, osx-arm64, win-x64
  • Root detection: via pubspec.yaml and pubspec.lock

Changes

  • packages/lsp/src/server.ts: Add DartServer definition with DART_RUNTIME_DEPS, getDartResourcesDir(), setupDartDependencies()
  • packages/lsp/src/index.ts: Export DartServer
  • packages/lsp/src/__tests__/server.test.ts: Add DartServer tests

Architecture

spawn() flow:
1. Check Bun.which('dart')
   ├─ Found: Use system dart directly
   └─ Not found:
      └─ setupDartDependencies()
         ├─ Check if SDK already downloaded
         │   ├─ Yes: Return dart binary path
         │   └─ No: Download SDK, extract, chmod, return path
         └─ Spawn: dart language-server --client-id dora.dart --client-version 1.0

Test Plan

  • Typecheck passes
  • Lint passes
  • All tests pass (65 tests in code-lsp)
  • Manual testing with a Dart project

Closes #8

Add Dart LSP support with system-first fallback and auto-download:
- Check for system `dart` in PATH first
- Auto-download Dart SDK 3.7.1 if not found
- Support all major platforms: linux-x64, linux-arm64, osx-x64, osx-arm64, win-x64
- Root detection via pubspec.yaml and pubspec.lock

Closes #8
@amondnet amondnet linked an issue Dec 17, 2025 that may be closed by this pull request
7 tasks
- Extract process event handlers to attachLSPProcessHandlers() helper
- Add documentation explaining setupDartDependencies vs Kotlin pattern
- Add behavioral tests for root detection (pubspec.yaml/pubspec.lock)
- Update CLAUDE.md to include Dart in supported servers table
- Add test for nested monorepo package detection (inner pubspec.yaml)
- Add test for deep directory structure root detection
- Move tests from src/__tests__/ to test/ directory
- Add test/unit/ for unit tests
- Add test/integration/ for integration tests
- Add test/fixtures/ for test data
- Create Dart project fixture for LSP integration tests
- Add DartServer integration tests (serena pattern)
- Update package.json with test:unit and test:integration scripts

Directory structure follows Bun/Elysia conventions:
  test/
  ├── unit/           # Unit tests
  ├── integration/    # Integration tests
  └── fixtures/       # Test data
- Use `bun run test` which runs turbo for all packages
- Generate coverage from packages/lsp separately
- Update coverage file path for Codecov
- Create codecov.yml with component configuration
- Define components for each package: code, code-format, code-lsp, dora
- Generate coverage reports for all packages with tests
- Upload multiple coverage files to Codecov
@amondnet
amondnet merged commit c0a42d5 into main Dec 17, 2025
3 checks passed
@amondnet
amondnet deleted the 8-featlsp-add-dart-language-server-support branch December 17, 2025 17:41
@passionfactory-bot passionfactory-bot Bot mentioned this pull request Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(lsp): add Dart Language Server support

1 participant