mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Add MethodCall cases to Renderer
This commit is contained in:
parent
baa6c7a92f
commit
086466ab88
@ -71,8 +71,9 @@ termFields Info{..} syntax = "range" .= characterRange : "category" .= category
|
||||
Indexed c -> childrenFields c
|
||||
Fixed c -> childrenFields c
|
||||
Keyed c -> childrenFields c
|
||||
Syntax.FunctionCall identifier c -> [ "identifier" .= identifier ] <> childrenFields c
|
||||
Syntax.FunctionCall identifier params -> [ "identifier" .= identifier ] <> [ "params" .= params ]
|
||||
Syntax.Function identifier params c -> [ "identifier" .= identifier ] <> [ "params" .= params ] <> childrenFields c
|
||||
Syntax.MethodCall targetId methodId params -> [ "targetIdentifier" .= targetId ] <> [ "methodId" .= methodId ] <> [ "params" .= params ]
|
||||
where childrenFields c = [ "children" .= c ]
|
||||
|
||||
patchFields :: KeyValue kv => SplitPatch (Term leaf Info) -> [kv]
|
||||
|
@ -47,6 +47,7 @@ styleName category = "category-" <> case category of
|
||||
ArrayLiteral -> "array"
|
||||
Category.FunctionCall -> "function_call"
|
||||
Category.Function -> "function"
|
||||
Category.MethodCall -> "method_call"
|
||||
Identifier -> "identifier"
|
||||
Params -> "parameters"
|
||||
ExpressionStatements -> "expression_statements"
|
||||
@ -105,6 +106,8 @@ instance ToMarkup f => ToMarkup (Renderable (Source Char, Info, Syntax a (f, Ran
|
||||
Syntax.FunctionCall identifier children -> dl . mconcat $ (wrapIn dt <$> (contentElements source characterRange [identifier])) <> (wrapIn dd <$> contentElements source characterRange children)
|
||||
Syntax.Function identifier params expressions -> ul . mconcat $ wrapIn li <$>
|
||||
contentElements source characterRange (catMaybes [identifier, params, Just expressions])
|
||||
Syntax.MethodCall targetId methodId methodParams -> ul . mconcat $ wrapIn li <$>
|
||||
contentElements source characterRange [targetId, methodId, methodParams]
|
||||
|
||||
contentElements :: (Foldable t, ToMarkup f) => Source Char -> Range -> t (f, Range) -> [Markup]
|
||||
contentElements source range children = let (elements, next) = foldr' (markupForContextAndChild source) ([], end range) children in
|
||||
|
Loading…
Reference in New Issue
Block a user