Skip to content

Invalid signature message received from the LSP server #678

@amosnier

Description

@amosnier

See ycm-core/YouCompleteMe#4313, which is rooted in an invalid signature message received from the LSP server.

Quoting the YCM developer's analysis:

The following message is received from the LSP server:

ben@BenMBP2021 ~ % cat j | jq
{
  "jsonrpc": "2.0",
  "id": 131,
  "result": {
    "signatures": [
      {
        "label": "ufunc()",
        "documentation": {
          "kind": "plaintext",
          "value": "isnan(x, \\/, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature])\\n\\nTest element-wise for NaN and return result as a boolean array.\\n\\nParameters\\n----------\\nx : array_like\\n\\u00a0\\u00a0\\u00a0\\u00a0Input array.\\nout : ndarray, None, or tuple of ndarray and None, optional\\n\\u00a0\\u00a0\\u00a0\\u00a0A location into which the result is stored. If provided, it must have\\n\\u00a0\\u00a0\\u00a0\\u00a0a shape that the inputs broadcast to. If not provided or None,\\n\\u00a0\\u00a0\\u00a0\\u00a0a freshly-allocated array is returned. A tuple (possible only as a\\n\\u00a0\\u00a0\\u00a0\\u00a0keyword argument) must have length equal to the number of outputs.\\nwhere : array_like, optional\\n\\u00a0\\u00a0\\u00a0\\u00a0This condition is broadcast over the input. At locations where the\\n\\u00a0\\u00a0\\u00a0\\u00a0condition is True, the `out` array will be set to the ufunc result.\\n\\u00a0\\u00a0\\u00a0\\u00a0Elsewhere, the `out` array will retain its original value.\\n\\u00a0\\u00a0\\u00a0\\u00a0Note that if an uninitialized `out` array is created via the default\\n\\u00a0\\u00a0\\u00a0\\u00a0``out=None``, locations within it where the condition is False will\\n\\u00a0\\u00a0\\u00a0\\u00a0remain uninitialized.\\n**kwargs\\n\\u00a0\\u00a0\\u00a0\\u00a0For other keyword-only arguments, see the\\n\\u00a0\\u00a0\\u00a0\\u00a0:ref:`ufunc docs <ufuncs.kwargs>`.\\n\\nReturns\\n-------\\ny : ndarray or bool\\n\\u00a0\\u00a0\\u00a0\\u00a0True where ``x`` is NaN, false otherwise.\\n\\u00a0\\u00a0\\u00a0\\u00a0This is a scalar if `x` is a scalar.\\n\\nSee Also\\n--------\\nisinf, isneginf, isposinf, isfinite, isnat\\n\\nNotes\\n-----\\nNumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic\\n(IEEE 754). This means that Not a Number is not equivalent to infinity.\\n\\nExamples\\n--------\\n>>> import numpy as np\\n>>> np.isnan(np.nan)\\nTrue\\n>>> np.isnan(np.inf)\\nFalse\\n>>> np.isnan([np.log(-1.),1.,np.log(0)])\\narray([ True, False, False])"
        },
        "parameters": [
          {
            "label": "args",
            "documentation": {
              "kind": "plaintext",
              "value": ""
            }
          },
          {
            "label": "kwargs",
            "documentation": {
              "kind": "plaintext",
              "value": ""
            }
          }
        ]
      }
    ],
    "activeSignature": 0,
    "activeParameter": 0
  }
}

this is invalid according to to the specification.

The specification states that the label of each parameter must be substring of the label of the signature.

The signature label of ufunc() is clearly incorrect and thus invalid.
Image

Please raise this with the developer of the language server or use YCM's supported built-in Python support via Jedi. Or disable signature help of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions