Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion results are not be sorted properly #1093

Open
y-tag opened this issue Jun 19, 2024 · 1 comment
Open

Completion results are not be sorted properly #1093

y-tag opened this issue Jun 19, 2024 · 1 comment

Comments

@y-tag
Copy link

y-tag commented Jun 19, 2024

Description

After upgrading jupyterlab-lsp to 5.1, the order of completion results are different from those of jupyterlab-lsp 4.3.
The results seem to be not sorted properly.

Reproduce

I built a container image with this Dockerfile and use it.

  1. Type import numpy as np and run it.
  2. Type np. and press TAB.
  3. Type as.
  4. The results are shown.

Screenshot from 2024-06-19 20-59-22

Expected behavior

The results of jupyterlab-lsp 4.3 (with this Dockerfile) are as follows:

Screenshot from 2024-06-19 21-00-36

Words begging with "as" rank higher.

@y-tag
Copy link
Author

y-tag commented Jun 19, 2024

The comparison function in sorting might be here.

return (
aRank - bRank ||
(a.item.sortText ?? 'z').localeCompare(b.item.sortText ?? 'z') ||
a.score - b.score
);

I guess that the correct order is as follows:

  1. The sources of candidates, such as LSP and kernel.
  2. The matching scores.
  3. The sortTexts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant