Skills.MD
# LSP Hover Testing Skill
Automated headless testing of LSP hover functionality for the Dingo transpiler. Replaces manual VS Code hover checks with reproducible, CI-compatible tests.
## When to Use This Skill
- After making changes to sourcemap/position tracking code
- When debugging hover issues reported by users
- To validate that column/line mappings work correctly
- Before committing changes to `pkg/lsp/`, `pkg/sourcemap/`, or `pkg/transpiler/`
- To create regression tests for hover functionality
## Quick Start
```bash
# 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
```
## Spec File Format
Create YAML specs in `ai-docs/hover-specs/`:
```yaml
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)
```
## Assertion Types
| 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` |
## Output Format
```
http_handler.yaml:
------------------------------------------------------------
1: works
2: works
3: expected "var r", got "func extractUserID..."
4: works
============================================================
Total: 3 passed, 1 failed
```
## Creating New Test Specs
### Step 1: Identify test positions
```bash
# Show line numbers
sed -n '50,70p' examples/01_error_propagation/http_handler.dingo | nl -ba
```
### Step 2: Create spec file
```bash
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
```
### Step 3: Run and iterate
```bash
./lsp-hovercheck --spec ai-docs/hover-specs/my_example.yaml --verbose
```
## Debugging Failed Tests
When a test fails, check:
1. **Column position**: Is the token found at the right column?
2. **Tab handling**: Lines starting with tabs may have offset issues
3. **Transformed lines**: Error prop lines map to different Go positions
4. **LSP readiness**: Increase `--retries` if hover returns empty
### Verbose debug output
```bash
./lsp-hovercheck --spec ai-docs/hover-specs/http_handler.yaml --verbose
```
Shows:
- Exact LSP request/response JSON
- Computed column positions
- Hover content returned
## Known Limitations
### VS Code vs Automated Differences
The automated test may show different results than VS Code due to:
- Tab character handling differences
- LSP initialization timing
- VS Code extension preprocessing
### Current Behavior (2025-12-14)
| 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 Locations
| 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 |
## CI Integration
Add to your CI pipeline:
```yaml
- 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"
```
## Related Files
- [Spec format reference](SPEC_FORMAT.md)
- [Debugging guide](DEBUGGING.md)
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「lsp-hover-testing」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次