ccls
ccls copied to clipboard
Call structure pointer member completion error in macro
Observed behavior
But when i call a member of sturct pointer (like np->a). The completer will add the -> to the header of .c file.
It only happend when I try to complete the member of the struct pointer in the Macro functions.
Here the screenshot will show the behavior clearly.

The configuration of ccls:
{
"languageserver": {
"ccls": {
"command": "ccls",
"filetypes": [
"c",
"cpp",
"cuda",
"objc",
"objcpp"
],
"rootPatterns": [
".ccls",
"compile_commands.json"
],
"initializationOptions": {
"cache": {
"directory": "/tmp/ccls"
},
"client": {
"snippetSupport": true
},
"highlight": {
"lsRanges": true
}
}
}
}
}
The file i test the bug.
#include <stdio.h>
#define add(x,y) ((x)+(y))
int addf(int x, int y){
return x+y;
}
int main(int argc, char *argv[])
{
struct num {
int a;
int b;
};
struct num n = {
.a = 1,
.b = 2,
};
struct num *np = &n;
np->a = 2;
addf(np->a, np->b);
add(np->a, np->b);
return 0;
}
Expected behavior
The expected behavior is when I try to complete the member of struct pointer in a macro function, will same as the completion in normal funciton.
Steps to reproduce
In the macro function, call a struct pointer member list use '.' and select a member and use enter to complete.
System information
- ccls version (
git describe --tags --long): 0.20201025-0-g1fec76c8 - clang version: 10.0.0
- OS: ubuntu 18.04
- Editor: neovim v0.4.4
- Language client (and version): coc.nvim version: 0.0.79-8230b63641
I get the same error when using emacs