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

Fix type enclosing deduplication #1864

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

voodoos
Copy link
Collaborator

@voodoos voodoos commented Nov 21, 2024

Deduplication can only be done if the type have been printed which is an expensive process. We perform that printing only at the junction between the reconstructed identifier's enclosings and the ones from the tree nodes because we often want to keep both (often this gives the generic type and then its specialized version). All other duplicated ranges are removed.

Deduplication can only be done if the type have been printed. We perform that printing only at the junction between the reconstructed identifier enclosings and the ones from the tree nodes because we often want to keep both. All other duplicated ranges are removed.
@voodoos voodoos force-pushed the fix-type-enclosing-deduplication branch from 5444aa2 to d6ba564 Compare November 21, 2024 13:39
"line": 1,
"col": 12
},
"type": "(module Stdlib__List)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a function that replace M__N by M.N, should we use it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, that's the work of short-path. If I enable it in the concerned tests the results are the ones we expect. (And maybe we should simply do that for type search too...)

Since deduplciation has been introduced a while ago the results of type-enclosing (the number of enclosings) have been unstable. This cannot be solved easily on the server-side without printing more types which can lead to performance issues when large modules are involed. We now leave the responsability of deduplication to the clients.
@voodoos
Copy link
Collaborator Author

voodoos commented Nov 25, 2024

Deduplication of resulting enclosings have made the type-enclosing query unstable for a while: the number of resulting enclosing could vary depending on the selected index.

This PR initially tried to improve deduplication by printing more types, but that can lead to performance issues when these types involve large modules.

Doing deduplication while ensuring a minimal performance impact makes the implementation awkward and complex. We finally decided to remove-it all together: clients should filter redundant results as they appear.

@voodoos voodoos merged commit 91fcd6c into ocaml:main Nov 26, 2024
3 of 4 checks passed
voodoos added a commit to voodoos/merlin that referenced this pull request Nov 26, 2024
from voodoos/fix-type-enclosing-deduplication

Change entry for ocaml#1854
voodoos added a commit to voodoos/opam-repository that referenced this pull request Nov 26, 2024
CHANGES:

Tue Nov 26 17:30:42 CET 2024

  + merlin binary
    - Respect the `EXCLUDE_QUERY_DIR` configuration directive when looking for cmt
      files (ocaml/merlin#1854)
    - Fix occurrences bug in which relative paths in index files are resolved against the
      PWD rather than the SOURCE_ROOT (ocaml/merlin#1855)
    - Fix exception in polarity search (ocaml/merlin#1858 fixes ocaml/merlin#1113)
    - Fix jump to `fun` targets not working (ocaml/merlin#1863, fixes ocaml/merlin#1862)
    - Fix type-enclosing results instability. This reverts some overly
      aggressive deduplication that should be done on the client side. (ocaml/merlin#1864)
    - Fix occurrences not working when the definition comes from a hidden source
      file (ocaml/merlin#1865)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Nov 26, 2024
CHANGES:

Tue Nov 26 17:30:42 CET 2024

  + merlin binary
    - Respect the `EXCLUDE_QUERY_DIR` configuration directive when looking for
      cmt files (ocaml/merlin#1854)
    - Fix exception in polarity search (ocaml/merlin#1858 fixes ocaml/merlin#1113)
    - Fix type-enclosing results instability. This reverts some overly
      aggressive deduplication that should be done on the client side. (ocaml/merlin#1864)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Nov 26, 2024
CHANGES:

Tue Nov 26 17:30:42 CET 2024

  + merlin binary
    - Respect the `EXCLUDE_QUERY_DIR` configuration directive when looking for cmt
      files (ocaml/merlin#1854)
    - Fix occurrences bug in which relative paths in index files are resolved against the
      PWD rather than the SOURCE_ROOT (ocaml/merlin#1855)
    - Fix exception in polarity search (ocaml/merlin#1858 fixes ocaml/merlin#1113)
    - Fix jump to `fun` targets not working (ocaml/merlin#1863, fixes ocaml/merlin#1862)
    - Fix type-enclosing results instability. This reverts some overly
      aggressive deduplication that should be done on the client side. (ocaml/merlin#1864)
    - Fix occurrences not working when the definition comes from a hidden source
      file (ocaml/merlin#1865)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Nov 26, 2024
CHANGES:

Tue Nov 26 17:30:42 CET 2024

  + merlin binary
    - Respect the `EXCLUDE_QUERY_DIR` configuration directive when looking for
      cmt files (ocaml/merlin#1854)
    - Fix exception in polarity search (ocaml/merlin#1858 fixes ocaml/merlin#1113)
    - Fix type-enclosing results instability. This reverts some overly
      aggressive deduplication that should be done on the client side. (ocaml/merlin#1864)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 4.18-414
Development

Successfully merging this pull request may close these issues.

2 participants