https://github.com/MaskRay/ccls/issues/226
client->a
I get autocompletion like this: a : int tcp_client_s
After selecting that autocompletion the code looks like this:
client->a : int
ArchLinux with ccls for C/C++/ObjC (git version installed a5f600a7)
https://github.com/MaskRay/ccls
Package Control
"ccls":
{
"command":
[
"ccls"
],
"initializationOptions":
{
"cacheDirectory": "/tmp/ccls"
},
"languages":
[
{
"languageId": "c",
"scopes":
[
"source.c"
],
"syntaxes":
[
"Packages/C++/C.sublime-syntax"
]
},
{
"languageId": "cpp",
"scopes":
[
"source.c++"
],
"syntaxes":
[
"Packages/C++/C++.sublime-syntax"
]
},
{
"languageId": "objective-c",
"scopes":
[
"source.objc"
],
"syntaxes":
[
"Packages/Objective-C/Objective-C.sublime-syntax"
]
},
{
"languageId": "objective-cpp",
"scopes":
[
"source.objc++"
],
"syntaxes":
[
"Packages/Objective-C/Objective-C++.sublime-syntax"
]
}
]
}
So I tried the ccls server mentioned, and I get the same kind of completions. The ccls server sends textEdit in addition to a label for its completion items.
There is an easy fix for your problem. There's a "hidden" setting called complete_using_text_edit that will enable the functionality to prefer textEdit over label. Just put
"complete_using_text_edit": true,
somewhere in your LSP preferences.
Some background reading: https://github.com/tomv564/LSP/issues/368 https://github.com/tomv564/LSP/issues/294
Definition, References, Rename functions does not work with CCLS.
Definition, References, Rename functions does not work with CCLS.
It does for me. Are you working with cmake? If so, you need to put a generated compile_commands.json file with cmake path/to/src -DCMAKE_EXPORT_COMPILE_COMMANDS=ON in the root of your source dir (something like ln -s compile_commands.json path/to/build/dir/compile_commands.json)
No. I鈥檓 working with meson and I softlinked the compile_commands.json to the root project too.
Oh, I needed to add the file to meson, build it (to generate new compile_commands.json) and then restart Sublime to get that working again.
Ah right, so it sends label but no insertText. We should probably change complete_using_text_edit to be the default behaviour, ideally after adding some test coverage
Yeah. In fact, I think insertText is deprecated.
Ah right, so it sends label but no insertText. We should probably change
complete_using_text_editto be the default behaviour, ideally after adding some test coverage
Has this happened yet? I just spent like a half hour trying to get ccls to work just to figure out that complete_using_text_edit breaks the LSP plugin now.
In what way does it break this plugin?
Has this happened yet?
No, but feel free to do so and make a pull request if it's urgent.
@CoolOppo PR #524 makes the plugin prefer textEdit over insertText by default.
Awesome, didn't see that. I deeply appreciate the hard work on this project, it literally is making my job (and life) so much better.
Most helpful comment
So I tried the ccls server mentioned, and I get the same kind of completions. The ccls server sends
textEditin addition to alabelfor its completion items.There is an easy fix for your problem. There's a "hidden" setting called
complete_using_text_editthat will enable the functionality to prefertextEditoverlabel. Just putsomewhere in your LSP preferences.
Some background reading: https://github.com/tomv564/LSP/issues/368 https://github.com/tomv564/LSP/issues/294