mirror of
https://github.com/github/semantic.git
synced 2024-12-30 02:14:20 +03:00
Introduce new renderToSymbols
This commit is contained in:
parent
7aaeca419f
commit
77f5b0a1d6
@ -12,6 +12,7 @@ module Rendering.Renderer
|
||||
, renderToCTerm
|
||||
, renderSymbolTerms
|
||||
, renderToSymbols
|
||||
, renderToSymbols'
|
||||
, renderTreeGraph
|
||||
, renderJSONError
|
||||
, Summaries(..)
|
||||
|
@ -1,6 +1,7 @@
|
||||
{-# LANGUAGE RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
|
||||
module Rendering.Symbol
|
||||
( renderToSymbols
|
||||
, renderToSymbols'
|
||||
, SymbolFields(..)
|
||||
, defaultSymbolFields
|
||||
, parseSymbolFields
|
||||
@ -16,6 +17,8 @@ import Data.List.Split (splitWhen)
|
||||
import Data.Term
|
||||
import qualified Data.Text as T
|
||||
import Rendering.TOC
|
||||
import Tags.Tagging
|
||||
import Tags.Taggable
|
||||
|
||||
|
||||
-- | Render a 'Term' to a list of symbols (See 'Symbol').
|
||||
@ -25,6 +28,9 @@ renderToSymbols fields Blob{..} term = [toJSON (termToC fields blobPath term)]
|
||||
termToC :: (Foldable f, Functor f) => SymbolFields -> FilePath -> Term f (Maybe Declaration) -> File
|
||||
termToC fields path = File (T.pack path) (T.pack (show blobLanguage)) . mapMaybe (symbolSummary fields path "unchanged") . termTableOfContentsBy declaration
|
||||
|
||||
renderToSymbols' :: (IsTaggable fs) => SymbolFields -> Blob -> Term (Sum fs) Location -> [Tag]
|
||||
renderToSymbols' _ blob term = either mempty id (runTagging blob term)
|
||||
|
||||
-- | Construct a 'Symbol' from a node annotation and a change type label.
|
||||
symbolSummary :: SymbolFields -> FilePath -> T.Text -> Declaration -> Maybe Symbol
|
||||
symbolSummary SymbolFields{..} path _ record = case record of
|
||||
|
Loading…
Reference in New Issue
Block a user