[all-commits] [llvm/llvm-project] c86f79: [clangd][VSCode] Force VSCode to use the ranking p...

Sam McCall via All-commits all-commits at lists.llvm.org
Fri Mar 6 04:35:22 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c86f794bd555a272f0f74a0b0a48f158e84b26b4
      https://github.com/llvm/llvm-project/commit/c86f794bd555a272f0f74a0b0a48f158e84b26b4
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-03-06 (Fri, 06 Mar 2020)

  Changed paths:
    M clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts

  Log Message:
  -----------
  [clangd][VSCode] Force VSCode to use the ranking provided by clangd.

Summary:
Clangd's approach is to provide lots of completions, and let ranking sort them
out. This relies on various important signals (Quality.h), without which the
large completion lists are extremely spammy.

Even with a completion result exactly at the cursor, vscode looks backwards and
tries to match the presumed partial-identifier against filterText, and uses
the result to rank, with sortText only used as a tiebreak.
By prepending the partial-identifier to the filterText, we can force the match
to be perfect and so give sortText full control of the ranking.

Full sad story: https://github.com/microsoft/language-server-protocol/issues/898

It's possible to do this on the server side too of course, and switch it on
with an initialization option. But it's a little easier in the extension, it
will get the fix to users of old clangd versions, and other editors

Reviewers: hokein

Reviewed By: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75623




More information about the All-commits mailing list