mirror of
https://github.com/github/semantic.git
synced 2024-12-27 17:05:33 +03:00
slice/firstLine are total.
This commit is contained in:
parent
bbb583de55
commit
65eed49ecc
@ -46,13 +46,13 @@ contextualizing Blob{..} symbolsToSummarize = Streaming.mapMaybeM $ \case
|
|||||||
Exit x r -> Nothing <$ exitScope (x, r)
|
Exit x r -> Nothing <$ exitScope (x, r)
|
||||||
Iden iden span docsLiteralRange -> get @[ContextToken] >>= pure . \case
|
Iden iden span docsLiteralRange -> get @[ContextToken] >>= pure . \case
|
||||||
((x, r):("Context", cr):_) | x `elem` symbolsToSummarize
|
((x, r):("Context", cr):_) | x `elem` symbolsToSummarize
|
||||||
-> Just $ Tag iden x span (firstLine (slice (Just r))) (slice (Just cr))
|
-> Just $ Tag iden x span (Just (firstLine (slice r))) (Just (slice cr))
|
||||||
((x, r):_) | x `elem` symbolsToSummarize
|
((x, r):_) | x `elem` symbolsToSummarize
|
||||||
-> Just $ Tag iden x span (firstLine (slice (Just r))) (slice docsLiteralRange)
|
-> Just $ Tag iden x span (Just (firstLine (slice r))) (slice <$> docsLiteralRange)
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
where
|
where
|
||||||
slice = fmap (stripEnd . Source.toText . Source.slice blobSource)
|
slice = stripEnd . Source.toText . Source.slice blobSource
|
||||||
firstLine = fmap (T.take 180 . fst . breakOn "\n")
|
firstLine = T.take 180 . fst . breakOn "\n"
|
||||||
|
|
||||||
enterScope, exitScope :: ( Member (State [ContextToken]) sig
|
enterScope, exitScope :: ( Member (State [ContextToken]) sig
|
||||||
, Carrier sig m
|
, Carrier sig m
|
||||||
|
Loading…
Reference in New Issue
Block a user