1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Only parse out alias from basename for a couple of languages

This commit is contained in:
Timothy Clem 2018-01-30 12:38:57 -08:00
parent a63c3a940a
commit 9e977ebb71

View File

@ -133,8 +133,8 @@ instance (Declaration.ImportSymbol :< fs) => CustomHasDeclaration (Union fs) Dec
= Just $ ImportDeclaration name (getAlias blobLanguage (getSource aliasAnn)) (mapMaybe getSymbol symbols) blobLanguage
where
name = getSource fromAnn
getAlias lang alias | Just Ruby <- lang, T.null alias = alias
| T.null alias = basename name
getAlias lang alias | Just TypeScript <- lang, T.null alias = basename name
| Just Go <- lang, T.null alias = basename name
| otherwise = alias
basename = last . T.splitOn "/"
getSource = T.dropAround (`elem` ['"', '\'']) . toText . flip Source.slice blobSource . getField