type: fixed formatting type when there is an array of modules

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
pull/13952/head
Vincenzo Palazzo 2022-04-05 18:07:21 +02:00
parent 617608b23d
commit 009e5b6135
No known key found for this signature in database
GPG Key ID: 8B6DC2B870B80D5F
1 changed files with 7 additions and 0 deletions

View File

@ -1155,6 +1155,13 @@ fn (t Table) shorten_user_defined_typenames(originalname string, import_aliases
} else if res in import_aliases { } else if res in import_aliases {
res = import_aliases[res] res = import_aliases[res]
} else { } else {
// FIXME: clean this case and remove the following if
// because it is an hack to format well the type when
// there is a []modul.name
if res.contains('[]') {
idx := res.index('.') or { -1 }
return res.substr(idx + 1, res.len)
}
// types defined by the user // types defined by the user
// mod.submod.submod2.Type => submod2.Type // mod.submod.submod2.Type => submod2.Type
mut parts := res.split('.') mut parts := res.split('.')