Skip to content

Commit

Permalink
extend symbol signature to work with int(32) and real(?w)
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Apr 23, 2024
1 parent 6c88758 commit 7f40179
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/chpl-language-server/src/symbol_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def _get_symbol_signature(node: chapel.AstNode) -> List[Component]:
return _var_to_string(node)
elif isinstance(node, chapel.Function):
return _proc_to_string(node)
elif isinstance(node, chapel.TypeQuery):
return [_wrap_str(f"?{node.name()}")]

return [_wrap_str(node.name())]

Expand Down Expand Up @@ -171,6 +173,8 @@ def _node_to_string(node: chapel.AstNode) -> List[Component]:
return [_wrap_str('"' + node.value() + '"')]
elif isinstance(node, chapel.CStringLiteral):
return [_wrap_str('c"' + node.value() + '"')]
elif isinstance(node, chapel.FnCall):
return _fncall_to_string(node)
return [Component(ComponentTag.PLACEHOLDER, None)]


Expand Down Expand Up @@ -299,3 +303,20 @@ def _intent_to_string(intent: Optional[str]) -> str:
}
# use 'intent' as the default, so if no remap no work done
return remap.get(intent, intent) if intent else ""

def _fncall_to_string(call: chapel.FnCall) -> List[Component]:
"""
Convert a call to a string
"""
comps = []

comps.extend(_node_to_string(call.called_expression()))
comps.append(_wrap_str("[" if call.used_square_brackets() else "("))
sep = ""
for a in call.actuals():
comps.append(_wrap_str(sep))
sep = ", "
comps.extend(_node_to_string(a))
comps.append(_wrap_str("]" if call.used_square_brackets() else ")"))

return comps

0 comments on commit 7f40179

Please sign in to comment.