File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -165,19 +165,19 @@ func (p *FileParser) parseImportStatements(node *sitter.Node) bool {
165
165
}
166
166
} else if node .Type () == sitterNodeTypeImportFromStatement {
167
167
from := node .Child (1 ).Content (p .code )
168
+ // If the import is from the current package, we don't need to add it to the modules.
169
+ // If the import is from a different relative package i.e. from .package1 import foo, we need to add it to the modules.
170
+ if from == "." {
171
+ return true
172
+ }
168
173
for j := 3 ; j < int (node .ChildCount ()); j ++ {
169
174
m , ok := parseImportStatement (node .Child (j ), p .code )
170
175
if ! ok {
171
176
continue
172
177
}
173
- m .Filepath = p .relFilepath
174
-
175
- if from == "." {
176
- return true
177
- } else {
178
- m .From = from
179
- m .Name = fmt .Sprintf ("%s.%s" , from , m .Name )
180
- }
178
+ m .Filepath = p.relFilepath {
179
+ m.From = from
180
+ m .Name = fmt .Sprintf ("%s.%s" , from , m .Name )
181
181
p .output .Modules = append (p .output .Modules , m )
182
182
}
183
183
} else {
You can’t perform that action at this time.
0 commit comments