Skip to content

Commit ef0ee46

Browse files
committed
feat(devins-lang): improve symbol resolution for file commands
This commit enhances the symbol resolution in DevInLanguage by adding support for line information in commands. It also refactors the code to ensure that the `FoldingDescriptor` is added only when the element's text contains a forward slash, indicating a file path.
1 parent 2d8d1f1 commit ef0ee46

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/folding/DevInFileReferenceFoldingBuilder.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class DevInFileReferenceFoldingBuilder : FoldingBuilderEx() {
2424
override fun visitElement(element: PsiElement) {
2525
if (element.elementType == DevInTypes.COMMAND_PROP) {
2626
val agentId = element.parent?.findElementAt(1)?.text
27-
if (agentId == "file" && element.text.contains("/")) {
27+
val isAgentBase = agentId == "file" || agentId == "write" || agentId == "run"
28+
if (isAgentBase && element.text.contains("/")) {
2829
descriptors.add(FoldingDescriptor(element.node, element.textRange))
2930
}
3031
}

0 commit comments

Comments
 (0)