LSP Index Schema¶
Purpose¶
dsdld persists per-file index shards for warm-start workspace indexing and
workspace/symbol queries.
Schema version: 1 (LspIndexSchemaVersion).
File Naming¶
Each source file maps to one shard file in the configured index cache directory. The source path is encoded into a filesystem-safe key and written as:
<encoded-source-path>.index.json
JSON Structure¶
Each shard is a JSON object:
{
"schema_version": 1,
"metadata": {
"file_path": "/abs/path/TypeA.1.0.dsdl",
"source_uri": "file:///abs/path/TypeA.1.0.dsdl",
"text_hash": 123456789,
"snapshot_version": 42
},
"symbols": [
{
"usr": "type:demo.TypeA.1.0",
"name": "TypeA",
"qualified_name": "demo.TypeA.1.0",
"container_name": "demo",
"detail": "message",
"kind": 23,
"file_path": "/abs/path/TypeA.1.0.dsdl",
"location": {
"uri": "file:///abs/path/TypeA.1.0.dsdl",
"line": 0,
"character": 0,
"length": 5
}
}
],
"references": [
{
"target_usr": "type:demo.TypeA.1.0",
"file_path": "/abs/path/TypeA.1.0.dsdl",
"is_declaration": true,
"location": {
"uri": "file:///abs/path/TypeA.1.0.dsdl",
"line": 0,
"character": 0,
"length": 5
}
}
]
}
Schema Guarantees¶
schema_versionis required and must match the runtime schema constant.- Serialization is deterministic for identical shard content.
- Symbol/reference rows are sorted before persistence.
- Duplicate logical shards (same
metadata.file_path) are considered invalid. - Invalid shards are reported by verification and can be removed by repair.
Compatibility Strategy¶
- Any schema change increments
schema_version. - Older schema versions are rejected by the current runtime.
- Unsupported shard files are treated as invalid cache entries.
- Verification/repair can remove unsupported shards for clean warm-starts.