jupyter-lsp / jupyterlab-lsp

Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
https://jupyterlab-lsp.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.82k stars 148 forks source link

Jump to definition bug with repeated definitions #808

Open mlucool opened 2 years ago

mlucool commented 2 years ago

Description

If a function is defined twice, jump to definition always jumps to the first definition and not the latest.

Reproduce

jump-to-def

Expected behavior

The second add should jump to the add right above it.

Context

krassowski commented 2 years ago

Interesting, I cannot reproduce, neither on master nor on Binder with an older version (using python-lsp-server):

cannot-repro

There is selector for the case if language server returns multiple targets (#739) but it was not released yet; in any case it seems pylsp returns only the correct match. It could however vary depending on dependencies of pylsp itself (jedi?).

krassowski commented 2 years ago

I can see that pyright returns both options. In the current stable version indeed the first one is always chosen. On master (with #739) we get a rudimentary selector:

jumpselector

We can improve the rendering of it greatly (e.g. show the actual cell) in the future.

krassowski commented 1 year ago

@mlucool the jump target selector was included in v4.0.0. Can we close this issue?