Description
When completing TOML table headers that involve additionalProperties in the JSON schema, Taplo returns incorrect textEdit.range values. The range covers the entire table header path, but the replacement text is only the leaf property name.
Steps to Reproduce
-
Use a schema like pixi's manifest schema where feature uses additionalProperties:
"feature": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Feature"
}
}
And Feature has properties like pypi-dependencies.
-
In a TOML file, type [feature.ci. and trigger completion
-
Select pypi-dependencies from completion
-
Expected: [feature.ci.pypi-dependencies]
Actual: [pypi-dependencies] (the feature.ci. prefix is replaced/deleted)
Root Cause Analysis
Taplo returns a textEdit like:
{
"range": { "start": { "character": 1 }, "end": { "character": 12 } },
"newText": "pypi-dependencies"
}
The range covers feature.ci. (cols 1-12), but newText is only pypi-dependencies. This causes editors to replace the entire path with just the leaf name.
Schema Path Comparison
| Path |
Schema Definition |
Completion |
activation.scripts |
Direct $ref |
✅ Works |
feature.ci.pypi-dependencies |
additionalProperties → $ref |
❌ Broken |
The issue appears specific to paths that traverse through additionalProperties (dynamic keys).
Environment
Related
- blink.cmp#2343 - Initially reported there, confirmed to be upstream Taplo issue
Description
When completing TOML table headers that involve
additionalPropertiesin the JSON schema, Taplo returns incorrecttextEdit.rangevalues. The range covers the entire table header path, but the replacement text is only the leaf property name.Steps to Reproduce
Use a schema like pixi's manifest schema where
featureusesadditionalProperties:And
Featurehas properties likepypi-dependencies.In a TOML file, type
[feature.ci.and trigger completionSelect
pypi-dependenciesfrom completionExpected:
[feature.ci.pypi-dependencies]Actual:
[pypi-dependencies](thefeature.ci.prefix is replaced/deleted)Root Cause Analysis
Taplo returns a
textEditlike:{ "range": { "start": { "character": 1 }, "end": { "character": 12 } }, "newText": "pypi-dependencies" }The range covers
feature.ci.(cols 1-12), butnewTextis onlypypi-dependencies. This causes editors to replace the entire path with just the leaf name.Schema Path Comparison
activation.scripts$reffeature.ci.pypi-dependenciesadditionalProperties→$refThe issue appears specific to paths that traverse through
additionalProperties(dynamic keys).Environment
Related