question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot include CocConfig, fail to use compile_commands.json

See original GitHub issue

Issue

I’m running Coc.nvim in VIM8 and trying to use coc-clangd as the LSP for autocomplete. Autocomplete doesn’t seem to work for larger projects with dependencies spread across directories. It works fine with small projects where all .cpp and .h files are in the same directory.

I have created a compile_commands.json file with xcodebuild and xcpretty. But clangd doesn’t seem to use it. I have tried putting the .json file all throughout the project directory to no avail.

My :CocConfig is empty as directed by docs to avoid running clangd twice.

Should I be making config entries, and if so how do I do so and avoid the “You should remove it” error?

Versions

Clangd version 10.0.0 MacOS: 10.15.5

CocList

## versions

vim version: VIM - Vi IMproved 8.1 8012250
node version: v13.13.0
coc.nvim version: 0.0.78-2407993395
coc.nvim directory: /Users/brianarne/.vim/plugged/coc.nvim
term: iTerm.app
platform: darwin

## Output channel: clangd log

I[22:35:52.414] clangd version 10.0.0 
I[22:35:52.414] PID: 37798
I[22:35:52.414] Working directory: /Users/brianarne/Projects/Tremelo/Source
I[22:35:52.414] argv[0]: /usr/local/opt/llvm/bin/clangd
I[22:35:52.414] Starting LSP over stdin/stdout
I[22:35:52.415] <-- initialize(0)
I[22:35:52.432] --> reply:initialize(0) 16 ms
I[22:35:52.435] <-- initialized
I[22:35:52.435] unhandled notification initialized
I[22:35:52.437] <-- textDocument/didOpen
I[22:35:52.438] Enqueueing 2 commands for indexing
I[22:35:52.440] --> textDocument/clangd.fileStatus
I[22:35:52.440] Updating file /Users/brianarne/Projects/Tremelo/Source/PluginEditor.h with command inferred from /Users/brianarne/Projects/Tremelo/Source/PluginEditor.cpp
[/]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-macos10.11 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -stdlib=libc++ -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -D_DEBUG=1 -DDEBUG=1 -DJUCER_XCODE_MAC_F6D2F4CF=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000 -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=1 -DJucePlugin_Build_AU=1 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=1 -DJucePlugin_Build_Unity=0 -DJUCE_SHARED_CODE=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -I/Users/brianarne/Projects/Tremelo/Builds/MacOSX/build/Debug/include -I/Users/brianarne/JUCE/modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I/Users/brianarne/JUCE/modules -I/Users/brianarne/JUCE/modules/juce_audio_plugin_client -I/Users/brianarne/Projects/Tremelo/Builds/MacOSX/build/Tremelo.build/Debug/Tremelo - Shared Code.build/DerivedSources-normal/x86_64 -I/Users/brianarne/Projects/Tremelo/Builds/MacOSX/build/Tremelo.build/Debug/Tremelo - Shared Code.build/DerivedSources/x86_64 -I/Users/brianarne/Projects/Tremelo/Builds/MacOSX/build/Tremelo.build/Debug/Tremelo - Shared Code.build/DerivedSources -Wreorder -F/Users/brianarne/Projects/Tremelo/Builds/MacOSX/build/Debug --serialize-diagnostics /Users/brianarne/Projects/Tremelo/Builds/MacOSX/build/Tremelo.build/Debug/Tremelo - Shared Code.build/Objects-normal/x86_64/PluginEditor.dia -c -x c++-header -std=c++14 /Users/brianarne/Projects/Tremelo/Source/PluginEditor.h -fsyntax-only -resource-dir=/usr/local/Cellar/llvm/10.0.0_3/lib/clang/10.0.0
I[22:35:52.468] --> textDocument/publishDiagnostics
I[22:35:52.468] --> textDocument/clangd.fileStatus

## Output channel: watchman

[Info  - 10:35:52 PM] watchman watching project: /Users/brianarne/Projects/Tremelo
[Info  - 10:35:52 PM] subscribing "**/{compile_commands.json,compile_flags.txt,.clang-tidy}" in /Users/brianarne/Projects/Tremelo

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fannheywardcommented, Jun 19, 2020

You need to open C/C++ files to run :CocCommand clangd.install.

0reactions
BrianArnecommented, Jun 19, 2020

I feel like a fool. This “bug” was related to the way the framework and build tools interact.

Officially resolved. Thank you work taking a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

neoclide/coc.nvim - Gitter
I can't seem to find any settings that allow that behaviour ... or if using ccls, through .ccls config or compile_commands.json.
Read more >
Error using ccls with nvim : r/neovim - Reddit
nvim] Server languageserver.ccls failed to start: Launching server "languageserver.ccls" using command ccls failed. CocConfig (coc-settings.json):
Read more >
coc for C++ setup - Codevion vimwiki
Install coc in vim config: Plug 'neoclide/coc.nvim', {'branch': 'release'}. :CocConfig and then ...
Read more >
Getting Server languageserver.ccls failed to start: error, when ...
ccls" using command ccls failed. I have installed coc-ccls, and I have pasted this below code inside cocconfig file, { "languageserver": { " ......
Read more >
Give the path for compile_commands.json file to coc-clangd
I have the setup working when the compile_commands.json is in the "root of the src dir" ... How do I tell coc to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found