Skip to content

Autocompletion partially works with numpy #2080

@ubaldot

Description

@ubaldot

I made some research and I found this that led me here.

However, I am not sure if the issue is on jedi or if it is on the lsp client that I am using.

The autocompletion works it other python modules, but with numpy.

To reproduce:

import numpy as np

a = np.array([1,2,3]) # when I type 'np.' then I get a list of all possible completions when I hit '.'
a. # Here, I don't get anything when I hit '.'

An excerpt of the lsp debug messages follows:

...
11/23/25 17:52:17: Sent {"method":"textDocument/completion","params":{"context":{"triggerCharacter":"","triggerKind":1},"textDocument":{"uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"position":{"character":1,"line":4}}}
11/23/25 17:52:17: Received {"id":15,"jsonrpc":"2.0","result":{"isIncomplete":false,"items":[{"label":"a","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aa","kind":6,"insertText":"a"},{"label":"abs(x)","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aabs","kind":3,"insertText":"abs"},{"label":"all(iterable)","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aall","kind":3,"insertText":"all"},{"label":"any(iterable)","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aany","kind":3,"insertText":"any"},{"label":"ascii(obj)","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aascii","kind":3,"insertText":"ascii"},{"label":"assert","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aassert","kind":14,"insertText":"assert"},{"label":"async","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aasync","kind":14,"insertText":"async"},{"label":"await","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aawait","kind":14,"insertText":"await"},{"label":"ArithmeticError","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aArithmeticError","kind":7,"insertText":"ArithmeticError"},{"label":"AssertionError","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aAssertionError","kind":7,"insertText":"AssertionError"},{"label":"AttributeError","data":{"doc_uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"sortText":"aAttributeError","kind":7,"insertText":"AttributeError"}]}}
11/23/25 17:52:17: Received {"method":"textDocument/publishDiagnostics","jsonrpc":"2.0","params":{"uri":"file:///Users/ubaldot/Documents/test_lsp.py","diagnostics":[{"source":"pyflakes","message":"'manim as mn' imported but unused","severity":2,"range":{"end":{"character":19,"line":1},"start":{"character":0,"line":1}}}],"version":78}}
11/23/25 17:52:18: Sent {"method":"textDocument/completion","params":{"context":{"triggerCharacter":".","triggerKind":2},"textDocument":{"uri":"file:///Users/ubaldot/Documents/test_lsp.py"},"position":{"character":2,"line":4}}}
11/23/25 17:52:18: Received {"id":16,"jsonrpc":"2.0","result":{"isIncomplete":false,"items":[]}}
11/23/25 17:52:18: Received {"method":"textDocument/publishDiagnostics","jsonrpc":"2.0","params":{"uri":"file:///Users/ubaldot/Documents/test_lsp.py","diagnostics":[{"source":"pyflakes","message":"invalid syntax","severity":1,"range":{"end":{"character":6,"line":4},"start":{"character":3,"line":4}}}],"version":79}}
11/23/25 17:52:45: Received {"method":"textDocument/publishDiagnostics","jsonrpc":"2.0","params":{"uri":"file:///Users/ubaldot/Documents/test_lsp.py","diagnostics":[{"source":"pyflakes","message":"invalid syntax","severity":1,"range":{"end":{"character":6,"line":3},"start":{"character":3,"line":3}}}],"version":80}}
...

As you see, there is a suspicious line that suggests that the lsp server does not return anything.

11/23/25 17:52:18: Received {"id":16,"jsonrpc":"2.0","result":{"isIncomplete":false,"items":[]}}

I am using numpy 2.3.1, python 3.12.11 pylsp v1.13.0, jedi 0.19.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions