mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Only parse out alias from basename for a couple of languages
This commit is contained in:
parent
a63c3a940a
commit
9e977ebb71
@ -133,8 +133,8 @@ instance (Declaration.ImportSymbol :< fs) => CustomHasDeclaration (Union fs) Dec
|
|||||||
= Just $ ImportDeclaration name (getAlias blobLanguage (getSource aliasAnn)) (mapMaybe getSymbol symbols) blobLanguage
|
= Just $ ImportDeclaration name (getAlias blobLanguage (getSource aliasAnn)) (mapMaybe getSymbol symbols) blobLanguage
|
||||||
where
|
where
|
||||||
name = getSource fromAnn
|
name = getSource fromAnn
|
||||||
getAlias lang alias | Just Ruby <- lang, T.null alias = alias
|
getAlias lang alias | Just TypeScript <- lang, T.null alias = basename name
|
||||||
| T.null alias = basename name
|
| Just Go <- lang, T.null alias = basename name
|
||||||
| otherwise = alias
|
| otherwise = alias
|
||||||
basename = last . T.splitOn "/"
|
basename = last . T.splitOn "/"
|
||||||
getSource = T.dropAround (`elem` ['"', '\'']) . toText . flip Source.slice blobSource . getField
|
getSource = T.dropAround (`elem` ['"', '\'']) . toText . flip Source.slice blobSource . getField
|
||||||
|
Loading…
Reference in New Issue
Block a user