ワンクリックで
lsp-hover-testing
// Automated LSP hover validation for Dingo transpiler. Use when testing hover functionality, validating position mappings, checking for hover drift, or debugging LSP issues after sourcemap changes.
// Automated LSP hover validation for Dingo transpiler. Use when testing hover functionality, validating position mappings, checking for hover drift, or debugging LSP issues after sourcemap changes.
| name | lsp-hover-testing |
| description | Automated LSP hover validation for Dingo transpiler. Use when testing hover functionality, validating position mappings, checking for hover drift, or debugging LSP issues after sourcemap changes. |
| allowed-tools | Read, Grep, Glob, Bash, Write, Edit |
Automated headless testing of LSP hover functionality for the Dingo transpiler. Replaces manual VS Code hover checks with reproducible, CI-compatible tests.
pkg/lsp/, pkg/sourcemap/, or pkg/transpiler/# Build the tools first
go build -o dingo ./cmd/dingo
go build -o editors/vscode/server/bin/dingo-lsp ./cmd/dingo-lsp
go build -o lsp-hovercheck ./cmd/lsp-hovercheck
# Run hover tests
./lsp-hovercheck --spec "ai-docs/hover-specs/*.yaml"
# Verbose output for debugging
./lsp-hovercheck --spec ai-docs/hover-specs/http_handler.yaml --verbose
Create YAML specs in ai-docs/hover-specs/:
file: examples/01_error_propagation/http_handler.dingo
cases:
- id: 1
line: 55 # 1-based line number
token: userID # Token to hover on
occurrence: 1 # Which occurrence (default: 1)
description: "LHS variable"
expect:
contains: "var userID string" # Must contain substring
# OR
containsAny: # Any of these
- "var userID"
- "userID string"
# OR
allowAny: true # Accept any result (skip assertion)
| Type | Description | Example |
|---|---|---|
contains | Must contain substring | contains: "func foo" |
containsAny | Any of listed substrings | containsAny: ["func", "method"] |
notContains | Must not contain | notContains: "error" |
allowAny | Skip assertion, just record | allowAny: true |
http_handler.yaml:
------------------------------------------------------------
1: works
2: works
3: expected "var r", got "func extractUserID..."
4: works
============================================================
Total: 3 passed, 1 failed
# Show line numbers
sed -n '50,70p' examples/01_error_propagation/http_handler.dingo | nl -ba
cat > ai-docs/hover-specs/my_example.yaml << 'EOF'
file: examples/my_example/file.dingo
cases:
- id: 1
line: 10
token: myFunction
description: "Function name hover"
expect:
contains: "func myFunction"
EOF
./lsp-hovercheck --spec ai-docs/hover-specs/my_example.yaml --verbose
When a test fails, check:
--retries if hover returns empty./lsp-hovercheck --spec ai-docs/hover-specs/http_handler.yaml --verbose
Shows:
The automated test may show different results than VS Code due to:
| Position Type | Automated Result | VS Code Result |
|---|---|---|
| Function names | Works | Works |
| Function arguments | Works | Shows function sig (bug) |
| LHS variables | Empty | Shows temp var (bug) |
| File | Purpose |
|---|---|
cmd/lsp-hovercheck/ | Hover check tool source |
ai-docs/hover-specs/ | Test specification files |
editors/vscode/server/bin/dingo-lsp | LSP server binary |
Add to your CI pipeline:
- name: Build tools
run: |
go build -o dingo ./cmd/dingo
go build -o editors/vscode/server/bin/dingo-lsp ./cmd/dingo-lsp
go build -o lsp-hovercheck ./cmd/lsp-hovercheck
- name: Run hover tests
run: ./lsp-hovercheck --spec "ai-docs/hover-specs/*.yaml"