python-language-server
python-language-server copied to clipboard
Multiple signatures in one label
Notice how the label contains two signatures:
{
"signatures": [
{
"documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given.\xa0\xa0If x is a number, return x.__int__().\xa0\xa0For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base.\xa0\xa0The literal can be preceded by '+' or '-' and be surrounded\nby whitespace.\xa0\xa0The base defaults to 10.\xa0\xa0Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4",
"label": "int(x: Union[Text, bytes, SupportsInt, _SupportsIndex]=...) int(x: Union[Text, bytes, bytearray], base: int)",
"parameters": [{"documentation": null, "label": "x"}]
}
],
"activeSignature": 0,
"activeParameter": 0
}
running
import jedi
script = jedi.Script("int(")
print(script.call_signatures())
returns two separate signatures:
[<CallSignature: index=0 int(x: Union[Text, bytes, SupportsInt, _SupportsIndex]=...)>,
<CallSignature: index=0 int(x: Union[Text, bytes, bytearray], base: int)>]