[clang-tools-extra] [clangd] Include the operator name in documentHighlight (PR #220518)
Christian Kandeler via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 11 07:40:49 PDT 2026
ckandeler wrote:
> 1. We highlight the `operator` declaration, yet the same issue remains with the usages.
>
> ```c++
> struct S {
> void [[operator]] [[+]](int); // operator and + in the range
> };
> void f(S a, int b) {
> a.[[operator]] +(b); // only operator in the range
> }
> ```
Done.
> 2. find-all-references/definition still return the range of `operator` keyword only.
I deliberately excluded "find references", because I suspect the average client will not be prepared to handle multi-line results, which can now happen with non-contrived code.
> 3. Literal operators are not covered
>
> ```c++
> long double [[operator]]""_test(long double); // only operator keyword in the range
> // (however hover on _test works)
> auto Test = [[1.0_test]];
> ```
Done.
> 4. Conversion operator are not covered
>
> ```c++
> struct S {
> [[operator]] int(); // only operator keyword in the range
> };
> S A;
> int B = [[A]];
> ```
Done.
https://github.com/llvm/llvm-project/pull/220518
More information about the cfe-commits
mailing list