| 163 | |
| 164 | // Helper to get the root crate/module from a scoped path |
| 165 | const getRootModule = (scopedNode: SyntaxNode): string => { |
| 166 | const firstChild = scopedNode.namedChild(0); |
| 167 | if (!firstChild) return source.substring(scopedNode.startIndex, scopedNode.endIndex); |
| 168 | if (firstChild.type === 'identifier' || |
| 169 | firstChild.type === 'crate' || |
| 170 | firstChild.type === 'super' || |
| 171 | firstChild.type === 'self') { |
| 172 | return source.substring(firstChild.startIndex, firstChild.endIndex); |
| 173 | } else if (firstChild.type === 'scoped_identifier') { |
| 174 | return getRootModule(firstChild); |
| 175 | } |
| 176 | return source.substring(firstChild.startIndex, firstChild.endIndex); |
| 177 | }; |
| 178 | |
| 179 | // Find the use argument (scoped_use_list or scoped_identifier) |
| 180 | const useArg = node.namedChildren.find((c: SyntaxNode) => |