Skip to content

Commit

Permalink
feat(devins-lang): improve symbol resolution for file commands
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phodal committed Mar 31, 2024
1 parent 2d8d1f1 commit ef0ee46
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -24,7 +24,8 @@ class DevInFileReferenceFoldingBuilder : FoldingBuilderEx() {
override fun visitElement(element: PsiElement) {
if (element.elementType == DevInTypes.COMMAND_PROP) {
val agentId = element.parent?.findElementAt(1)?.text
if (agentId == "file" && element.text.contains("/")) {
val isAgentBase = agentId == "file" || agentId == "write" || agentId == "run"
if (isAgentBase && element.text.contains("/")) {
descriptors.add(FoldingDescriptor(element.node, element.textRange))
}
}
Expand Down

0 comments on commit ef0ee46

Please sign in to comment.