[all-commits] [llvm/llvm-project] 976a74: [clangd] Dex Trigrams: Improve query trigram gener...

Kirill Bobyrev via All-commits all-commits at lists.llvm.org
Tue Dec 7 07:27:14 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 976a74d7d2dbd19670614f603caf490cca892fdc
      https://github.com/llvm/llvm-project/commit/976a74d7d2dbd19670614f603caf490cca892fdc
  Author: Kirill Bobyrev <kbobyrev at google.com>
  Date:   2021-12-07 (Tue, 07 Dec 2021)

  Changed paths:
    M clang-tools-extra/clangd/index/dex/Trigram.cpp
    M clang-tools-extra/clangd/unittests/DexTests.cpp

  Log Message:
  -----------
  [clangd] Dex Trigrams: Improve query trigram generation

These are the trigrams for queries right now:

- "va" -> {Trigram("va")}
- "va_" -> {} (empty)

This is suboptimal since the resulting query will discard the query information
and return all symbols, some of which will be later be scored expensively
(fuzzy matching score). This is related to
https://github.com/clangd/clangd/issues/39 but does not fix it. Accidentally,
because of that incorrect behavior, when user types "tok::va" there are no
results (the issue is that `tok::kw___builtin_va_arg` does not have "va" token)
but when "tok::va_" is typed, expected result (`tok::kw___builtin_va_arg`)
shows up by accident. This is because the dex query transformer will only
lookup symbols within the `tok::` namespace. There won't be many, so the
returned results will contain symbol we need; this symbol will be filtered out
by the expensive checks and that will be displayed in the editor.

Reviewed By: sammccall

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




More information about the All-commits mailing list