Need help using Compilations Commands clangd extension

I’m trying to use the clangd Compilations Commands LSP extention to notify the server of command changes.
It does not work for me. (Windows 10). clangd appears to accept the notify, but still looks for compile_commands.json . Then fails to create a g++.exe command.

Could someone suggest what I’m doing wrong:

The short blurb at [url]https://clangd.llvm.org/extensions.html[/url] states:

<
New configuration setting : settings.compilationDatabaseChanges : {string: CompileCommand}

  • Provides compile commands for files. This can also be provided on startup as initializationOptions.compilationDatabaseChanges .
  • Keys are file paths (Not URIs! bug?)
  • Values are {workingDirectory: string, compilationCommand: string[]}
    />

I’m trying this by sending a Notify workspace/didChangeconfiguration like:

09:39:11.890 Content-Length: 708

{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"F:/usr/Proj/HelloWorld/HelloWorld.cpp":{"compilationCommand":["g++.exe","-Wall","-fexceptions","-O2","-c","F:/usr/Proj/HelloWorld/HelloWorld.cpp","-o","obj/Release/HelloWorld.o","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed","-If:/usr/MinGW810_64seh/x86_64-w64-mingw32/include"],"workingDirectory":"F:/usr/Proj/HelloWorld"}}}}}

Here is the resulting clangd log:

Project: HelloWorld: F:\usr\Proj\HelloWorld\HelloWorld.cbp
I[09:39:10.593] clangd version 10.0.0 (https://github.com/msys2/MINGW-packages.git 742c89637afd3ef05e578759d9dfeb5dc247a6a3)

I[09:39:10.593] Working directory: F:\usr\Proj\HelloWorld

I[09:39:10.593] argv[0]: F:\user\programs\msys64\mingw64\bin\clangd.exe

I[09:39:10.593] argv[1]: --log=verbose

I[09:39:10.593] argv[2]: -j=4

I[09:39:10.593] argv[3]: --limit-results=20

I[09:39:10.593] argv[4]: --suggest-missing-includes

I[09:39:10.593] Starting LSP over stdin/stdout

V[09:39:11.562] <<< {"id":"initialize","jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"offsetEncoding":["utf-8"],"textDocument":{"codeAction":{"codeActionLiteralSupport":true},"completion":{"completionItem":{"deprecatedSupport":true,"snippetSupport":true},"completionItemKind":{"valueSet":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"editsNearCursor":true},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true},"hover":{"contentFormat":["plaintext"]},"publishDiagnostics":{"categorySupport":true,"codeActionsInline":true,"relatedInformation":true},"signatureHelp":{"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true}}}},"workspace":{"applyEdit":false,"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"workspaceEdit":{"documentChanges":false}}},"initializationOptions":{"clangdFileStatus":false,"compilationDatabasePath":null,"configSettings":{"compilationDatabaseChanges":{}},"fallbackFlags":[]},"processId":15688,"rootPath":null,"rootUri":"file:///F:/usr/Proj/HelloWorld"}}



I[09:39:11.562] <-- initialize("initialize")

I[09:39:11.562] --> reply:initialize("initialize") 1 ms

V[09:39:11.562] >>> {"id":"initialize","jsonrpc":"2.0","result":{"capabilities":{"codeActionProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":[".",">",":"]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n","moreTriggerCharacter":[]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]},"hoverProvider":true,"referencesProvider":true,"renameProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":2,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"offsetEncoding":"utf-8"}}



V[09:39:11.890] <<< {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"F:/usr/Proj/HelloWorld/HelloWorld.cpp":{"compilationCommand":["g++.exe","-Wall","-fexceptions","-O2","-c","F:/usr/Proj/HelloWorld/HelloWorld.cpp","-o","obj/Release/HelloWorld.o","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward","-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed","-If:/usr/MinGW810_64seh/x86_64-w64-mingw32/include"],"workingDirectory":"F:/usr/Proj/HelloWorld"}}}}}



I[09:39:11.890] <-- workspace/didChangeConfiguration

I[09:39:11.890] Failed to find compilation database for F:/usr/Proj/HelloWorld/HelloWorld.cpp

I[09:39:11.890] Enqueueing 1 commands for indexing

E[09:39:11.890] Tried to create storage for empty directory!

V[09:39:11.890] Failed to load shard: F:/usr\Proj\HelloWorld\HelloWorld.cpp

V[09:39:11.890] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"\r\n#include <iostream>\r\n#include <ostream>      //cout\r\n#include <stdio.h>       //printf\r\n\r\n#include \"HelloWorld.h\"\r\n\r\n\r\nint main()\r\n{\r\n    myFunction(\"stringToMyFunction\");\r\n\r\n    cout << \"Hello world!\" << endl;\r\n    printf(\"Hello World2\\n\");\r\n    printf(\"Hello World3\\n\");\r\n    return 0;\r\n\r\n}\r\n\r\nbool Aclass::myFunction2(std::string aString2)\r\n{\r\n    return true;\r\n}\r\n","uri":"file:///F:/usr/Proj/HelloWorld/HelloWorld.cpp","version":0}}}



I[09:39:11.890] <-- textDocument/didOpen

V[09:39:11.890] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"#ifndef HELLOWORLD_H_INCLUDED\r\n#define HELLOWORLD_H_INCLUDED\r\n\r\n#include <iostream>\r\n#include <stdio.h>\r\n#include \"stdio.h\"\r\n\r\nusing namespace std;\r\n\r\nbool myFunction(std::string aString)\r\n{\r\n    printf(\"myFunction got a string\\n\");\r\n    return true;\r\n}\r\n// ----------------------------------------------------------------------------\r\nclass Aclass\r\n// ----------------------------------------------------------------------------\r\n{\r\n  public:\r\n    Aclass();\r\n   ~Aclass();\r\n    bool myFunction2(std::string aString2);\r\n};\r\n\r\n#endif // HELLOWORLD_H_INCLUDED\r\n","uri":"file:///F:/usr/Proj/HelloWorld/HelloWorld.h","version":0}}}



I[09:39:11.890] <-- textDocument/didOpen

I[09:39:11.890] Failed to find compilation database for F:\usr\Proj\HelloWorld\HelloWorld.cpp

V[09:39:11.890] Indexing F:/usr/Proj/HelloWorld/HelloWorld.cpp (digest:=412460D459CF199D)

I[09:39:11.890] Updating file F:\usr\Proj\HelloWorld\HelloWorld.cpp with command clangd fallback

[F:\usr\Proj\HelloWorld]

F:\User\Programs\msys64\mingw64\bin\clang F:\usr\Proj\HelloWorld\HelloWorld.cpp -fsyntax-only -resource-dir=F:\user\programs\msys64\mingw64\lib\clang\10.0.0

I[09:39:11.890] Failed to find compilation database for F:\usr\Proj\HelloWorld\HelloWorld.h

I[09:39:11.890] Updating file F:\usr\Proj\HelloWorld\HelloWorld.h with command clangd fallback

[F:\usr\Proj\HelloWorld]

F:\User\Programs\msys64\mingw64\bin\clang -xobjective-c++-header F:\usr\Proj\HelloWorld\HelloWorld.h -fsyntax-only -resource-dir=F:\user\programs\msys64\mingw64\lib\clang\10.0.0

V[09:39:11.890] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name HelloWorld.h -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir F:\user\programs\msys64\mingw64\lib\clang\10.0.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\backward -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\backward -internal-isystem F:\user\programs\msys64\mingw64\lib\clang\10.0.0\include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32/sys-root/mingw/include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include -internal-isystem F:\User\Programs\msys64\mingw64\include -fdeprecated-macro -fdebug-compilation-dir F:\usr\Proj\HelloWorld -ferror-limit 19 -fmessage-length 0 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fobjc-exceptions -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -faddrsig -x objective-c++-header F:\usr\Proj\HelloWorld\HelloWorld.h

V[09:39:11.890] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name HelloWorld.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir F:\user\programs\msys64\mingw64\lib\clang\10.0.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\backward -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\backward -internal-isystem F:\user\programs\msys64\mingw64\lib\clang\10.0.0\include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32/sys-root/mingw/include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include -internal-isystem F:\User\Programs\msys64\mingw64\include -fdeprecated-macro -fdebug-compilation-dir F:\usr\Proj\HelloWorld -ferror-limit 19 -fmessage-length 0 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -faddrsig -x c++ F:\usr\Proj\HelloWorld\HelloWorld.cpp

V[09:39:11.890] <<< {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"F:/usr/Proj/HelloWorld/HelloWorld.cpp":{"compilationCommand":["g++.exe","-Wall","-fexceptions","-O2","-c","F:/usr/Proj/HelloWorld/HelloWorld.cpp","-o","obj/Release/HelloWorld.o","-I-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++","-I-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32","-I-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward","-I-If:/usr/MinGW810_64seh/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed","-I-If:/usr/MinGW810_64seh/x86_64-w64-mingw32/include"],"workingDirectory":"F:/usr/Proj/HelloWorld"}}}}}



V[09:39:11.906] Building first preamble for F:\usr\Proj\HelloWorld\HelloWorld.h

V[09:39:11.906] Building first preamble for F:\usr\Proj\HelloWorld\HelloWorld.cpp

I[09:39:11.906] <-- workspace/didChangeConfiguration

I[09:39:11.906] Enqueueing 1 commands for indexing

V[09:39:11.906] Failed to load shard: F:/usr\Proj\HelloWorld\HelloWorld.cpp

V[09:39:11.906] Indexing F:/usr/Proj/HelloWorld/HelloWorld.cpp (digest:=412460D459CF199D)

V[09:39:11.906] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"\r\n#include <iostream>\r\n#include <ostream>      //cout\r\n#include <stdio.h>       //printf\r\n\r\n#include \"HelloWorld.h\"\r\n\r\n\r\nint main()\r\n{\r\n    myFunction(\"stringToMyFunction\");\r\n\r\n    cout << \"Hello world!\" << endl;\r\n    printf(\"Hello World2\\n\");\r\n    printf(\"Hello World3\\n\");\r\n    return 0;\r\n\r\n}\r\n\r\nbool Aclass::myFunction2(std::string aString2)\r\n{\r\n    return true;\r\n}\r\n","uri":"file:///F:/usr/Proj/HelloWorld/HelloWorld.cpp","version":0}}}



I[09:39:11.906] <-- textDocument/didOpen

V[09:39:12.265] index AST for F:\usr\Proj\HelloWorld\HelloWorld.cpp (main=false): 

  symbol slab: 6646 symbols, 2021232 bytes

  ref slab: 0 symbols, 0 refs, 136 bytes

  relations slab: 354 relations, 8728 bytes

V[09:39:12.359] index AST for F:\usr\Proj\HelloWorld\HelloWorld.h (main=false): 

  symbol slab: 6642 symbols, 2020304 bytes

  ref slab: 0 symbols, 0 refs, 136 bytes

  relations slab: 354 relations, 8728 bytes

I[09:39:12.390] Indexed F:/usr/Proj/HelloWorld/HelloWorld.cpp (5268 symbols, 19738 refs, 126 files)

I[09:39:12.406] Indexed F:/usr/Proj/HelloWorld/HelloWorld.cpp (5462 symbols, 20499 refs, 134 files)

V[09:39:12.421] Built preamble of size 2648756 for file F:\usr\Proj\HelloWorld\HelloWorld.cpp

V[09:39:12.421] index AST for F:\usr\Proj\HelloWorld\HelloWorld.cpp (main=true): 

  symbol slab: 2 symbols, 4688 bytes

  ref slab: 11 symbols, 12 refs, 4496 bytes

  relations slab: 0 relations, 24 bytes

I[09:39:12.421] --> textDocument/publishDiagnostics

V[09:39:12.421] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///F:/usr/Proj/HelloWorld/HelloWorld.cpp"}}



I[09:39:12.421] Failed to find compilation database for F:\usr\Proj\HelloWorld\HelloWorld.cpp

I[09:39:12.421] Updating file F:\usr\Proj\HelloWorld\HelloWorld.cpp with command clangd fallback

[F:\usr\Proj\HelloWorld]

F:\User\Programs\msys64\mingw64\bin\clang F:\usr\Proj\HelloWorld\HelloWorld.cpp -fsyntax-only -resource-dir=F:\user\programs\msys64\mingw64\lib\clang\10.0.0

V[09:39:12.421] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name HelloWorld.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir F:\user\programs\msys64\mingw64\lib\clang\10.0.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\backward -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\backward -internal-isystem F:\user\programs\msys64\mingw64\lib\clang\10.0.0\include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32/sys-root/mingw/include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include -internal-isystem F:\User\Programs\msys64\mingw64\include -fdeprecated-macro -fdebug-compilation-dir F:\usr\Proj\HelloWorld -ferror-limit 19 -fmessage-length 0 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -faddrsig -x c++ F:\usr\Proj\HelloWorld\HelloWorld.cpp

V[09:39:12.437] Reusing preamble for F:\usr\Proj\HelloWorld\HelloWorld.cpp

I[09:39:12.437] Skipping rebuild of the AST for F:\usr\Proj\HelloWorld\HelloWorld.cpp, inputs are the same.

V[09:39:12.531] Built preamble of size 2650892 for file F:\usr\Proj\HelloWorld\HelloWorld.h

V[09:39:12.531] index AST for F:\usr\Proj\HelloWorld\HelloWorld.h (main=true): 

  symbol slab: 5 symbols, 5384 bytes

  ref slab: 8 symbols, 11 refs, 4424 bytes

  relations slab: 0 relations, 24 bytes

I[09:39:12.531] --> textDocument/publishDiagnostics

V[09:39:12.531] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///F:/usr/Proj/HelloWorld/HelloWorld.h"}}



I[09:39:12.531] Failed to find compilation database for F:\usr\Proj\HelloWorld\HelloWorld.h

I[09:39:12.531] Updating file F:\usr\Proj\HelloWorld\HelloWorld.h with command clangd fallback

[F:\usr\Proj\HelloWorld]

F:\User\Programs\msys64\mingw64\bin\clang -xobjective-c++-header F:\usr\Proj\HelloWorld\HelloWorld.h -fsyntax-only -resource-dir=F:\user\programs\msys64\mingw64\lib\clang\10.0.0

V[09:39:12.531] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name HelloWorld.h -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir F:\user\programs\msys64\mingw64\lib\clang\10.0.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\backward -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\include\c++\10.2.0\backward -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++ -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\x86_64-w64-mingw32 -internal-isystem F:\User\Programs\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.2.0\include\c++\backward -internal-isystem F:\user\programs\msys64\mingw64\lib\clang\10.0.0\include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32/sys-root/mingw/include -internal-isystem F:\User\Programs\msys64\mingw64\x86_64-w64-mingw32\include -internal-isystem F:\User\Programs\msys64\mingw64\include -fdeprecated-macro -fdebug-compilation-dir F:\usr\Proj\HelloWorld -ferror-limit 19 -fmessage-length 0 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fobjc-exceptions -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -faddrsig -x objective-c++-header F:\usr\Proj\HelloWorld\HelloWorld.h

V[09:39:12.546] Reusing preamble for F:\usr\Proj\HelloWorld\HelloWorld.h

I[09:39:12.546] Skipping rebuild of the AST for F:\usr\Proj\HelloWorld\HelloWorld.h, inputs are the same.

V[09:39:14.843] BackgroundIndex: building version 1 when background indexer is idle

V[09:39:14.937] BackgroundIndex: serving version 1 (10210777 bytes)

Are you writing your own LSP client, or extending an existing client to use this extension?

I’m writing a client for CodeBlocks from scratch on Windows 10.

Using a disk based compile_commands.json, the client work great.
Now I’m trying to switch to the commands LSP clangd extension so that I don’t have to kill and restart clangd after adding an entry to the disk based CDB for a newly opened file…

Got it, thanks. (And, great to hear about CodeBlocks getting LSP support!)

I’m not sure offhand what is going wrong with the extension. Will take a more detailed look later, but for now I wanted to mention that newer versions of clangd listen for file-changes to compile_commands.json and hot-reload the file, thereby relieving the client from the need to worry about this.

EDIT: I believe clangd 12 (not released yet but available via the weekly snapshot releases) is the first to have this feature.

Thanks. I’ll take a look at clangd 12.
Is it possible to use clangd 12 server with prior versions of clang. IE., can changd 12 be used with, say, clang 10?
Or will I have to ask users to upgrade to a clang distribution containing clangd 12?

Building with an older clang (or even with gcc) while using clangd 12 (e.g. a snapshot from Releases · clangd/clangd · GitHub) should work fine, I do it as well.

1 Like