0

I try to configure my VS Code environment for C/C++. I do it based on this guide: https://steelph0enix.github.io/posts/vscode-cpp-setup/

Currently I have a problem with Clangd. It doesn't seem to find the standard headers (e.g. iostream, 'iostream' file not foundclang(pp_file_not_found)). As I know Clangd get information where to look for standard headers from compile_commands.json. My compile_commands.json looks like:

[
{
  "directory": "E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/build",
  "command": "C:/cygwin64/bin/x86_64-pc-cygwin-g++.exe  @CMakeFiles/steelph0enix_vs_tutorial.dir/includes_CXX.rsp -g -o CMakeFiles/steelph0enix_vs_tutorial.dir/src/lib.cpp.obj -c E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/lib.cpp",
  "file": "E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/lib.cpp"
},
{
  "directory": "E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/build",
  "command": "C:/cygwin64/bin/x86_64-pc-cygwin-g++.exe  @CMakeFiles/steelph0enix_vs_tutorial.dir/includes_CXX.rsp -g -o CMakeFiles/steelph0enix_vs_tutorial.dir/src/main.cpp.obj -c E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp",
  "file": "E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"
}
]

Clangd output (with -log=verbose argument):

I[17:55:14.307] clangd version 13.0.0 (https://github.com/llvm/llvm-project d7b669b3a30345cfcdb2fde2af6f48aa4b94845d)
I[17:55:14.307] Features: windows+grpc
I[17:55:14.307] PID: 11728
I[17:55:14.307] Working directory: e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial
I[17:55:14.307] argv[0]: c:\Users\User\AppData\Roaming\Code\User\globalStorage\llvm-vs-code-extensions.vscode-clangd\install\13.0.0\clangd_13.0.0\bin\clangd.exe
I[17:55:14.307] argv[1]: -log=verbose
V[17:55:14.310] User config file is C:\Users\User\AppData\Local\clangd\config.yaml
I[17:55:14.310] Starting LSP over stdin/stdout
V[17:55:14.311] <<< {"id":0,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"marked","version":"1.1.0"},"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]}},"textDocument":{"callHierarchy":{"dynamicRegistration":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"dynamicRegistration":true,"honorsChangeAnnotations":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"codeLens":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},"completion":{"completionItem":{"commitCharactersSupport":true,"deprecatedSupport":true,"documentationFormat":["markdown","plaintext"],"insertReplaceSupport":true,"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true,"preselectSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{"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]},"contextSupport":true,"dynamicRegistration":true,"editsNearCursor":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"documentHighlight":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"documentSymbol":{"dynamicRegistration":true,"hierarchicalDocumentSymbolSupport":true,"labelSupport":true,"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]},"tagSupport":{"valueSet":[1]}},"foldingRange":{"dynamicRegistration":true,"lineFoldingOnly":true,"rangeLimit":5000},"formatting":{"dynamicRegistration":true},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"linkedEditingRange":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"codeDescriptionSupport":true,"dataSupport":true,"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":false},"rangeFormatting":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"honorsChangeAnnotations":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1},"selectionRange":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":false,"requests":{"full":{"delta":true},"range":true},"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"]},"signatureHelp":{"contextSupport":true,"dynamicRegistration":true,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"workDoneProgress":true},"workspace":{"applyEdit":true,"codeLens":{"refreshSupport":true},"configuration":true,"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true},"fileOperations":{"didCreate":true,"didDelete":true,"didRename":true,"dynamicRegistration":true,"willCreate":true,"willDelete":true,"willRename":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":true,"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]},"tagSupport":{"valueSet":[1]}},"workspaceEdit":{"changeAnnotationSupport":{"groupsOnLabel":true},"documentChanges":true,"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Visual Studio Code","version":"1.64.0"},"initializationOptions":{"clangdFileStatus":true,"fallbackFlags":[]},"locale":"en-us","processId":2420,"rootPath":"e:\\Karol\\Visual_Studio_repo\\steelph0enix_vs_tutorial","rootUri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial","trace":"off","workspaceFolders":[{"name":"steelph0enix_vs_tutorial","uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial"}]}}

I[17:55:14.311] <-- initialize(0)
I[17:55:14.317] --> reply:initialize(0) 6 ms
V[17:55:14.317] >>> {"id":0,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":true},"completionProvider":{"allCommitCharacters":[" ","\t","(",")","[","]","{","}","<",">",":",";",",","+","-","/","*","%","^","&","#","?",".","=","\"","'","|"],"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,"implementationProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","deprecated","deduced","readonly","static","abstract","dependentName","defaultLibrary","functionScope","classScope","fileScope","globalScope"],"tokenTypes":["variable","variable","parameter","function","method","function","property","variable","class","interface","enum","enumMember","type","type","unknown","namespace","typeParameter","concept","type","macro","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"serverInfo":{"name":"clangd","version":"clangd version 13.0.0 (https://github.com/llvm/llvm-project d7b669b3a30345cfcdb2fde2af6f48aa4b94845d) windows+grpc x86_64-pc-windows-msvc"}}}

V[17:55:14.322] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}

I[17:55:14.322] <-- initialized
V[17:55:14.322] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"#include <iostream>\r\n#include \"lib.hpp\"\r\n\r\nint main(void)\r\n{\r\n    std::cout << \"Helsdaslow world!\" << std::endl;\r\n    for\r\n    f(42);\r\n}","uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp","version":1}}}

I[17:55:14.322] <-- textDocument/didOpen
V[17:55:14.323] config note at e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\.clangd:1:0: Parsing config fragment
E[17:55:14.323] config error at e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\.clangd:1:0: Config should be a dictionary
V[17:55:14.323] config note at e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\.clangd:1:0: Parsed 0 fragments from file
I[17:55:14.323] --> textDocument/publishDiagnostics
V[17:55:14.323] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"Config should be a dictionary","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"relatedInformation":[],"severity":1,"source":"clangd-config"}],"uri":"file:///e:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/.clangd"}}

I[17:55:14.323] Loaded compilation database from e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\build/compile_commands.json
V[17:55:14.323] Broadcasting compilation database from e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial
I[17:55:14.324] ASTWorker building file e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp version 1 with command 
[E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/build]
"C:\\cygwin64\\bin\\x86_64-pc-cygwin-g++.exe" --target=x86_64-pc-cygwin --driver-mode=g++ -IE:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/include -g -o CMakeFiles/steelph0enix_vs_tutorial.dir/src/main.cpp.obj -c "-resource-dir=c:\\Users\\User\\AppData\\Roaming\\Code\\User\\globalStorage\\llvm-vs-code-extensions.vscode-clangd\\install\\13.0.0\\clangd_13.0.0\\lib\\clang\\13.0.0" -- "e:\\Karol\\Visual_Studio_repo\\steelph0enix_vs_tutorial\\src\\main.cpp"
V[17:55:14.324] config note at E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\.clangd:1:0: Parsing config fragment
E[17:55:14.324] config error at E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\.clangd:1:0: Config should be a dictionary
V[17:55:14.324] config note at E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\.clangd:1:0: Parsed 0 fragments from file
I[17:55:14.324] --> textDocument/publishDiagnostics
V[17:55:14.324] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"Config should be a dictionary","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"relatedInformation":[],"severity":1,"source":"clangd-config"}],"uri":"file:///E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/.clangd"}}

I[17:55:14.324] --> window/workDoneProgress/create(0)
V[17:55:14.324] >>> {"id":0,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"backgroundIndexProgress"}}

I[17:55:14.324] Enqueueing 2 commands for indexing
V[17:55:14.324] Failed to load shard: E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp
V[17:55:14.324] Failed to load shard: E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\lib.cpp
V[17:55:14.325] <<< {"id":0,"jsonrpc":"2.0","result":null}

I[17:55:14.325] <-- reply(0)
I[17:55:14.325] --> $/progress
V[17:55:14.325] Driver produced command: cc1 -cc1 -triple x86_64-pc-windows-cygnus -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/build -resource-dir "c:\\Users\\User\\AppData\\Roaming\\Code\\User\\globalStorage\\llvm-vs-code-extensions.vscode-clangd\\install\\13.0.0\\clangd_13.0.0\\lib\\clang\\13.0.0" -I E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/include -fdeprecated-macro -fdebug-compilation-dir=E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/build -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -x c++ "e:\\Karol\\Visual_Studio_repo\\steelph0enix_vs_tutorial\\src\\main.cpp"
V[17:55:14.325] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"begin","percentage":0,"title":"indexing"}}}

I[17:55:14.325] --> $/progress
I[17:55:14.325] --> textDocument/clangd.fileStatus
V[17:55:14.325] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/3","percentage":33}}}

V[17:55:14.325] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Update (1)","uri":"file:///e:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}

V[17:55:14.325] Building first preamble for e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp version 1
V[17:55:14.325] Indexing E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp (digest:=F5459C87439E7F41)
V[17:55:14.325] Indexing E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/lib.cpp (digest:=07BE53FD0DE2F8E8)
V[17:55:14.328] Ignored diagnostic. E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp:1:10:'iostream' file not found
V[17:55:14.328] Ignored diagnostic. E:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\lib.cpp:2:10:'iostream' file not found
I[17:55:14.329] Indexed E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp (2 symbols, 2 refs, 2 files)
I[17:55:14.329] Failed to compile E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp, index may be incomplete
I[17:55:14.329] Indexed E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/lib.cpp (1 symbols, 2 refs, 2 files)
I[17:55:14.329] Failed to compile E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/lib.cpp, index may be incomplete
V[17:55:14.331] <<< {"id":1,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}}

I[17:55:14.331] <-- textDocument/documentSymbol(1)
V[17:55:14.331] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[]},"range":{"end":{"character":1,"line":4},"start":{"character":1,"line":4}},"textDocument":{"uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}}

I[17:55:14.331] <-- textDocument/codeAction(2)
V[17:55:14.332] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/documentLink","params":{"textDocument":{"uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}}

I[17:55:14.332] <-- textDocument/documentLink(3)
I[17:55:14.332] --> $/progress
V[17:55:14.332] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"2/3","percentage":66}}}

V[17:55:14.333] BackgroundIndex: building version 1 when background indexer is idle
V[17:55:14.333] BackgroundIndex: serving version 1 (31808 bytes)
I[17:55:14.333] --> $/progress
V[17:55:14.333] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}

V[17:55:14.333] indexed preamble AST for e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp version 1:
  symbol slab: 1 symbols, 4456 bytes
  ref slab: 0 symbols, 0 refs, 136 bytes
  relations slab: 0 relations, 24 bytes
V[17:55:14.333] Build dynamic index for header symbols with estimated memory usage of 6940 bytes
V[17:55:14.334] Built preamble of size 214092 for file e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp version 1
I[17:55:14.334] --> workspace/semanticTokens/refresh(1)
V[17:55:14.334] >>> {"id":1,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}

I[17:55:14.334] --> textDocument/clangd.fileStatus
V[17:55:14.334] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Build AST for (1)","uri":"file:///e:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}

V[17:55:14.335] <<< {"id":1,"jsonrpc":"2.0","result":null}

I[17:55:14.335] <-- reply(1)
V[17:55:14.339] <<< {"id":4,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}}

I[17:55:14.339] <-- textDocument/semanticTokens/full(4)
V[17:55:14.341] Trying to fix unresolved name "cout" in scopes: [std::]
V[17:55:14.341] Dex query tree: false
V[17:55:14.341] Dex query tree: false
V[17:55:14.342] Trying to fix unresolved name "endl" in scopes: [std::]
V[17:55:14.342] Dex query tree: false
V[17:55:14.342] Dex query tree: false
V[17:55:14.342] indexed file AST for e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp version 1:
  symbol slab: 1 symbols, 4456 bytes
  ref slab: 1 symbols, 1 refs, 4256 bytes
  relations slab: 0 relations, 24 bytes
V[17:55:14.342] Build dynamic index for main-file symbols with estimated memory usage of 11536 bytes
I[17:55:14.342] --> textDocument/publishDiagnostics
V[17:55:14.342] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"pp_file_not_found","message":"'iostream' file not found","range":{"end":{"character":19,"line":0},"start":{"character":9,"line":0}},"relatedInformation":[],"severity":1,"source":"clang"},{"code":"undeclared_var_use","message":"Use of undeclared identifier 'std'","range":{"end":{"character":7,"line":5},"start":{"character":4,"line":5}},"relatedInformation":[],"severity":1,"source":"clang"},{"code":"undeclared_var_use","message":"Use of undeclared identifier 'std'","range":{"end":{"character":43,"line":5},"start":{"character":40,"line":5}},"relatedInformation":[],"severity":1,"source":"clang"},{"code":"expected_lparen_after","message":"Expected '(' after 'for'","range":{"end":{"character":5,"line":7},"start":{"character":4,"line":7}},"relatedInformation":[],"severity":1,"source":"clang"}],"uri":"file:///e:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp","version":1}}

V[17:55:14.342] ASTWorker running DocumentSymbols on version 1 of e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp
I[17:55:14.342] --> reply:textDocument/documentSymbol(1) 10 ms
V[17:55:14.342] >>> {"id":1,"jsonrpc":"2.0","result":[{"detail":"int ()","kind":12,"name":"main","range":{"end":{"character":1,"line":8},"start":{"character":0,"line":3}},"selectionRange":{"end":{"character":8,"line":3},"start":{"character":4,"line":3}}}]}

V[17:55:14.342] ASTWorker running EnumerateTweaks on version 1 of e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp
I[17:55:14.342] --> reply:textDocument/codeAction(2) 10 ms
V[17:55:14.342] >>> {"id":2,"jsonrpc":"2.0","result":[]}

V[17:55:14.342] ASTWorker running DocumentLinks on version 1 of e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp
I[17:55:14.342] --> reply:textDocument/documentLink(3) 10 ms
V[17:55:14.342] >>> {"id":3,"jsonrpc":"2.0","result":[{"range":{"end":{"character":18,"line":1},"start":{"character":9,"line":1}},"target":"file:///E:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/include/lib.hpp"}]}

V[17:55:14.342] ASTWorker running SemanticHighlights on version 1 of e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp
I[17:55:14.342] --> reply:textDocument/semanticTokens/full(4) 3 ms
V[17:55:14.342] >>> {"id":4,"jsonrpc":"2.0","result":{"data":[3,4,4,3,2049],"resultId":"1"}}

I[17:55:14.342] --> textDocument/clangd.fileStatus
V[17:55:14.342] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///e:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}

V[17:55:14.605] <<< {"id":5,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[]},"range":{"end":{"character":1,"line":4},"start":{"character":1,"line":4}},"textDocument":{"uri":"file:///e%3A/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}}

I[17:55:14.606] <-- textDocument/codeAction(5)
V[17:55:14.606] ASTWorker running EnumerateTweaks on version 1 of e:\Karol\Visual_Studio_repo\steelph0enix_vs_tutorial\src\main.cpp
I[17:55:14.606] --> reply:textDocument/codeAction(5) 0 ms
V[17:55:14.606] >>> {"id":5,"jsonrpc":"2.0","result":[]}

I[17:55:14.606] --> textDocument/clangd.fileStatus
V[17:55:14.606] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///e:/Karol/Visual_Studio_repo/steelph0enix_vs_tutorial/src/main.cpp"}}

I also would like to mention that .clangd file is empty.

kwit
  • 1
  • 1
  • 1
  • My suggestion is to uninstall Cygwin and [replace it with MSYS2](https://stackoverflow.com/q/30069830/2752075), and replace the official Clangd build with the one from MSYS2 repos. I wouldn't use Cygwin, unless you specifically want the POSIX emulation it provides. I know for sure that this combination (MSYS2 Clangd) works without any extra configuration. If you insist on Cygwin, then does Cygwin provide its own Clangd package? If yes, try that. Otherwise you might need to add some extra flags to `compile_commands.json`, such as `--sysroot=C:/cygwin64` (I think). – HolyBlackCat Feb 07 '22 at 17:29

1 Answers1

2

Try using the --query-driver argument to clangd, as described in this FAQ entry.

HighCommander4
  • 50,428
  • 24
  • 122
  • 194