MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 254 forks source link

Documenting "initialNoLinkage = true" #883

Open petergeoghegan opened 2 years ago

petergeoghegan commented 2 years ago

I am a user of ccls, via neovim (specifically the lspconfig plugin). I initially set out with the goal of using ccls as a full replacement for cscope, which meant that ccls had to provide something comparable to cscope's symbol lookup. This had to work without regard to the kind of symbol, or whether the referencing translation units were seen by ccls yet (I care about all symbols in the workspace).

It seemed at first that ccls didn't quite do everything that I wanted with a largely generic configuration (though it did do a great deal more than cscope in other areas). Eventually I figured out that setting index.initialNoLinkage = true gave me the desired behavior - I didn't have to open a .c file beforevim.lsp.buf.references() would recognize that the file's matching references should be treated as matches. I now have a configuration that I'm 100% happy with. Great!

It took me quite a bit of trial and error to figure all of this out - index.initialNoLinkage isn't documented. If it was prominently advertised in the wiki (say in the FAQ), then it would have saved me quite a few hours. Even the source code comment doesn't explain initialNoLinkage very clearly IMV. It seems to me that the wiki should be updated to nudge other users with the same requirements towards setting initialNoLinkage = true.

I haven't noticed any performance hit from setting initialNoLinkage = true, but I certainly have noticed the huge usability improvement. And so this very much seems like an oversight to me.

Thanks