1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00

🔥 the context field from Data.Tag.Tag.

This commit is contained in:
Rob Rix 2019-09-27 11:17:41 -04:00
parent ed85a4483f
commit 53f3e5e9cc
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 4 additions and 5 deletions

View File

@ -13,7 +13,6 @@ data Tag = Tag
{ name :: Text
, kind :: Text
, span :: Span
, context :: [Text]
, line :: Maybe Text
, docs :: Maybe Text
} deriving (Eq, Show, Generic)

View File

@ -45,10 +45,10 @@ contextualizing Blob{..} symbolsToSummarize = Streaming.mapMaybeM $ \case
Enter x r -> Nothing <$ enterScope (x, r)
Exit x r -> Nothing <$ exitScope (x, r)
Iden iden span docsLiteralRange -> get @[ContextToken] >>= pure . \case
((x, r):("Context", cr):xs) | x `elem` symbolsToSummarize
-> Just $ Tag iden x span (fmap fst xs) (firstLine (slice r)) (slice cr)
((x, r):xs) | x `elem` symbolsToSummarize
-> Just $ Tag iden x span (fmap fst xs) (firstLine (slice r)) (slice docsLiteralRange)
((x, r):("Context", cr):_) | x `elem` symbolsToSummarize
-> Just $ Tag iden x span (firstLine (slice r)) (slice cr)
((x, r):_) | x `elem` symbolsToSummarize
-> Just $ Tag iden x span (firstLine (slice r)) (slice docsLiteralRange)
_ -> Nothing
where
slice = fmap (stripEnd . Source.toText . Source.slice blobSource)