GNU bug report logs - #72765
Eglot + Clangd + Company + non-empty suffix = duplicate text

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dmitry <at> gutov.dev>

Date: Thu, 22 Aug 2024 23:09:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: 72765 <at> debbugs.gnu.org
Subject: bug#72765: Eglot + Clangd + Company + non-empty suffix = duplicate text
Date: Fri, 23 Aug 2024 02:07:59 +0300
Here's an example I came upon when testing:


test.c
```
int foo_bar_1;
int foo_bar_2;

int main() {foo_bar|456

```

Point is at |.

If you use completion-at-point, *Completions* buffer pops up, you choose 
one of the options with M-down and M-RET, "_1" is inserted. Good.

But if you use Company, type "_" (or backspace and re-add "r") - a popup 
comes up with "foo_bar_1" and "foo_bar_2", you choose one of the 
options, and the text becomes "foo_bar_1456456", suffix is duplicated.

This only happens with Clang, out of the servers I've tested.

You need a fairly recent Company to reproduce (from master), the 
previous versions simply didn't support completion in the middle of a 
symbol.

To add something that completion-at-point trips over, though: when 
"foo_bar_2" (existing var name) is already inserted, move point to the 
middle of it and press C-M-i:

```
  foo_|bar_2
```

will turn to

```
  foo_bar_2bar_2|
```




This bug report was last modified 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.