clangd / clangd

clangd language server
https://clangd.llvm.org
Apache License 2.0
1.54k stars 65 forks source link

Clangd does not find standard headers/functions or other includes, even though program builds correctly. #2088

Closed ymich9963 closed 3 months ago

ymich9963 commented 3 months ago

Hi! I tried doing what's on the website (i.e. Installing, a Config file , Troubleshooting, ) but it didn't really get me anywhere. Basically clangd isn't recognising any external header files or function definitions. Meaning std libraries or other. My compile_commands.json gets generated by CMake and it only recognises the files in the project directory but the functions defined in them are still not recognised. Furthermore, I'm not sure how to use a .clang file to point to the correct paths.

As detailed below my setup uses MSYS2 and the project compiles just fine. I'm guessing clangd needs some more help (as do I) to parse my code and provide me with hints, autocomplete etc. I am aware that the website tries to provide ways to troubleshoot this, but searching everywhere has provided with no solution and I hope someone can assist because it appears other people have similar problems!

Logs

I can't figure out how to use verbose logging so apologies about that, Maybe someone can help me if it's required later on. Each error message in the log using :LspLog starts with this line, so I'm isolating it to make the logs more readable and concise:

[ERROR][2024-07-08 21:34:50] .../vim/lsp/rpc.lua:734 "rpc" "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD" "stderr"

then by appending that line to the start of the log below you get the full log,

"I[21:34:50.238] <-- textDocument/didChange\r\nI[21:34:50.238] <-- textDocument/completion(4)\r\n"
"I[21:34:50.260] Code complete: sema context Statement, query scopes [] (AnyScope=true), expected type <none>\r\n"
"I[21:34:50.260] Code complete: 2 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 2 returned (incomplete).\r\nI[21:34:50.260] --> reply:textDocument/completion(4) 22 ms\r\n"
'I[21:34:50.304] ASTWorker building file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 3 with command clangd fallback\r\n[C:\\Users\\USER\\proj\\sndfile-test]\r\n"C:\\\\msys64\\\\usr\\\\bin\\\\clang" "-resource-dir=C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -- "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
"E[21:34:50.319] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"E[21:34:50.319] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:50.319] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"E[21:34:50.319] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:50.319] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:50.319] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"I[21:34:50.320] --> textDocument/publishDiagnostics\r\n"
"I[21:34:50.446] <-- textDocument/semanticTokens/full/delta(5)\r\nI[21:34:50.446] --> reply:textDocument/semanticTokens/full/delta(5) 0 ms\r\n"
"I[21:34:52.005] <-- textDocument/didChange\r\n"
'I[21:34:52.062] ASTWorker building file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 4 with command clangd fallback\r\n[C:\\Users\\USER\\proj\\sndfile-test]\r\n"C:\\\\msys64\\\\usr\\\\bin\\\\clang" "-resource-dir=C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -- "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
"E[21:34:52.077] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:52.077] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:52.077] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:52.077] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:52.077] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:52.077] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"I[21:34:52.079] --> textDocument/publishDiagnostics\r\n"
"I[21:34:52.220] <-- textDocument/semanticTokens/full/delta(6)\r\n"
"I[21:34:52.221] --> reply:textDocument/semanticTokens/full/delta(6) 0 ms\r\n"
"I[21:34:53.784] <-- textDocument/didChange\r\n"
'I[21:34:53.835] ASTWorker building file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 5 with command clangd fallback\r\n[C:\\Users\\USER\\proj\\sndfile-test]\r\n"C:\\\\msys64\\\\usr\\\\bin\\\\clang" "-resource-dir=C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -- "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
"I[21:34:53.992] <-- textDocument/semanticTokens/full/delta(7)\r\n"
"I[21:34:53.996] --> reply:textDocument/semanticTokens/full/delta(7) 4 ms\r\n"
"I[21:34:57.761] <-- shutdown(8)\r\nI[21:34:57.761] --> reply:shutdown(8) 0 ms\r\n"
"I[21:34:57.761] <-- exit\r\nI[21:34:57.761] LSP finished, exiting with status 0\r\n"
"I[21:34:58.282] clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)\r\nI[21:34:58.282] Features: windows+grpc\r\nI[21:34:58.282] PID: 3156\r\n"
"I[21:34:58.282] Working directory: C:\\Users\\USER\\proj\\sndfile-test\r\nI[21:34:58.282] argv[0]: C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\packages\\clangd\\clangd_18.1.3\\bin\\clangd.exe\r\n"
"I[21:34:58.286] Starting LSP over stdin/stdout\r\n"
"I[21:34:58.286] <-- initialize(1)\r\n"
"I[21:34:58.287] --> reply:initialize(1) 1 ms\r\n"
"I[21:34:58.288] <-- initialized\r\n"
"I[21:34:58.288] <-- textDocument/didOpen\r\n"
"I[21:34:58.288] <-- textDocument/semanticTokens/full(2)\r\n"
"E[21:34:58.288] config error at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Config should be a dictionary\r\n"
"I[21:34:58.289] --> textDocument/publishDiagnostics\r\n"
'I[21:34:58.289] Loaded compilation database from C:\\Users\\USER\\proj\\sndfile-test\\build/compile_commands.json\r\nI[21:34:58.289] ASTWorker building file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0 with command clangd fallback\r\n[C:\\Users\\USER\\proj\\sndfile-test]\r\n"C:\\\\msys64\\\\usr\\\\bin\\\\clang" "-resource-dir=C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -- "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
"I[21:34:58.305] Built preamble of size 238116 for file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0 in 0.01 seconds\r\n"
"I[21:34:58.305] --> workspace/semanticTokens/refresh(0)\r\n"
"I[21:34:58.306] <-- $/cancelRequest\r\n"
"I[21:34:58.306] <-- textDocument/semanticTokens/full(3)\r\nI[21:34:58.306] <-- reply(0)\r\n"
"E[21:34:58.323] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:58.323] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:58.323] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:58.323] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:58.323] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[21:34:58.323] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"I[21:34:58.324] --> textDocument/publishDiagnostics\r\n"
"I[21:34:58.324] --> reply:textDocument/semanticTokens/full(2) 36 ms, error: Task was cancelled.\r\nI[21:34:58.324] --> reply:textDocument/semanticTokens/full(3) 18 ms\r\n"

Here's some more information on how clangd is used in my configuration. This type of configuration with mason.nvim is very common so I don't think I'm doing anything crazy. Using :LspInfo in the currently open file, I get this output from mason.nvim,

image

The path points to a .cmd file with the following script which contains the clangd.exe.

@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "C:\Users\USER\AppData\Local\nvim-data\mason\packages\clangd\clangd_18.1.3/bin/clangd.exe" %*

System information

Output of clangd --version: Doesn't work on terminal but I'm using the LSP Logs

Editor/LSP plugin: NeoVim and this is my LSP Lua file

Operating system: Windows 11

HighCommander4 commented 3 months ago

Please have a look at https://clangd.llvm.org/troubleshooting#cant-find-standard-library-headers-map-stdioh-etc, in particular the second half regarding --query-driver, that tends to be needed on Windows setups using MinGW or MSYS.

HighCommander4 commented 3 months ago

Note, --query-driver is added in the same place as --log=verbose, so you'll need to figure out where that is.

I'm not a neovim user, but hopefully the pointers in this issue thread are helpful: https://github.com/llvm/clangd-www/issues/94

ymich9963 commented 3 months ago

Please have a look at https://clangd.llvm.org/troubleshooting#cant-find-standard-library-headers-map-stdioh-etc, in particular the second half regarding --query-driver, that tends to be needed on Windows setups using MinGW or MSYS.

Of course! Thank you for your quick reply! Do I pass that in the compile_commands.json? Where do I write that? And by /path/to/mygcc does that mean the path to the standard header files or the C:\msys64\usr\bin path for GCC?

HighCommander4 commented 3 months ago

Of course! Thank you for your quick reply! Do I pass that in the compile_commands.json? Where do I write that?

(See previous comment. Clangd arguments go in an editor-specific place, seems to be some kind of .lua file for neovim.)

And by /path/to/mygcc does that mean the path to the standard header files or the C:\msys64\usr\bin path for GCC?

It's the path to whatever compiler you're compiling with. In your case it's actually clang rather than gcc, so it would be something like C:\msys64\usr\bin\clang.

ymich9963 commented 3 months ago

Of course! Thank you for your quick reply! Do I pass that in the compile_commands.json? Where do I write that?

(See previous comment. Clangd arguments go in an editor-specific place, seems to be some kind of .lua file for neovim.)

And by /path/to/mygcc does that mean the path to the standard header files or the C:\msys64\usr\bin path for GCC?

It's the path to whatever compiler you're compiling with. In your case it's actually clang rather than gcc, so it would be something like C:\msys64\usr\bin\clang.

Thanks again for your help. I managed to figure it out thankfully. I'm not very knowledgable in lua!

Here's the log before the --query-driver=C:\msys64\usr\bin\clang.exe path added, with verbose logging. I have again removed the common clutter. I have an arrow to the cc1 command which shows that indeed it doesn't look where it should for the correct headers.

[ERROR][2024-07-08 23:43:09] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    'V[23:43:09.685] <<< {"id":4,"jsonrpc":"2.0","method":"shutdown"}\r\n\r\nI[23:43:09.685] <-- shutdown(4)\r\nI[23:43:09.685] --> reply:shutdown(4) 0 ms\r\nV[23:43:09.685] >>> {"id":4,"jsonrpc":"2.0","result":null}\r\n\r\n'
[ERROR][2024-07-08 23:43:09] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    'V[23:43:09.686] <<< {"jsonrpc":"2.0","method":"exit"}\r\n\r\n'
"I[23:43:09.686] <-- exit\r\nI[23:43:09.686] LSP finished, exiting with status 0\r\n"
"I[23:43:10.209] clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)\r\nI[23:43:10.209] Features: windows+grpc\r\nI[23:43:10.209] PID: 18208\r\nI[23:43:10.209] Working directory: C:\\Users\\USER\\proj\\sndfile-test\r\nI[23:43:10.209] argv[0]: C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\packages\\clangd\\clangd_18.1.3\\bin\\clangd.exe\r\nI[23:43:10.209] argv[1]: --log=verbose\r\n"
"V[23:43:10.212] User config file is C:\\Users\\USER\\AppData\\Local\\clangd\\config.yaml\r\nI[23:43:10.212] Starting LSP over stdin/stdout\r\n"
'V[23:43:10.213] <<< {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"dynamicRegistration":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"snippetSupport":false},"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":false,"dynamicRegistration":false,"editsNearCursor":true},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":false,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":true,"requests":{"full":{"delta":true},"range":false},"serverCancelSupport":false,"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","decorator"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"linkSupport":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}},"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":false,"relativePatternSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":false,"hierarchicalWorkspaceSymbolSupport":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]}},"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Neovim","version":"0.9.5"},"initializationOptions":{},"processId":4696,"rootPath":"C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test","rootUri":"file:///C:/Users/USER/proj/sndfile-test","trace":"off","workspaceFolders":[{"name":"C:/Users/USER/proj/sndfile-test","uri":"file:///C:/Users/USER/proj/sndfile-test"}]}}\r\n\r\nI[23:43:10.213] <-- initialize(1)\r\n'
"I[23:43:10.214] --> reply:initialize(1) 1 ms\r\n"
'V[23:43:10.215] >>> {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":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"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","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","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"offsetEncoding":"utf-8","serverInfo":{"name":"clangd","version":"clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0) windows+grpc x86_64-pc-windows-msvc"}}}\r\n\r\n'
'V[23:43:10.215] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}\r\n\r\nI[23:43:10.215] <-- initialized\r\n'
"V[23:43:10.215] <<< {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didOpen\",\"params\":{\"textDocument\":{\"languageId\":\"c\",\"text\":\"#include <stdio.h>\\r\\n#include <stdlib.h>\\r\\n#include <string.h>\\r\\n#include <ctype.h>\\r\\n#include <float.h>\\r\\n#include \\\"header.h\\\"\\r\\n#include <sndfile.h>\\r\\n\\r\\n#define\\tBLOCK_SIZE 4096\\r\\n\\r\\n#ifdef DBL_DECIMAL_DIG\\r\\n\\t#define OP_DBL_Digs (DBL_DECIMAL_DIG)\\r\\n#else\\r\\n\\t#ifdef DECIMAL_DIG\\r\\n\\t\\t#define OP_DBL_Digs (DECIMAL_DIG)\\r\\n\\t#else\\r\\n\\t\\t#define OP_DBL_Digs (DBL_DIG + 3)\\r\\n\\t#endif\\r\\n#endif\\r\\n\\r\\nstatic void\\r\\nprint_usage (char *progname)\\r\\n{\\tprintf (\\\"\\\\nUsage : %s [--full-precision] <input file> <output file>\\\\n\\\", progname) ;\\r\\n\\tputs (\\\"\\\\n\\\"\\r\\n\\t\\t\\\"    Where the output file will contain a line for each frame\\\\n\\\"\\r\\n\\t\\t\\\"    and a column for each channel.\\\\n\\\"\\r\\n\\t\\t) ;\\r\\n\\r\\n} /* print_usage */\\r\\n\\r\\nstatic int\\r\\nconvert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precision)\\r\\n{\\tfloat *buf ;\\r\\n\\tsf_count_t frames ;\\r\\n\\tint k, m, readcount ;\\r\\n\\r\\n\\tbuf = malloc (BLOCK_SIZE * sizeof (float)) ;\\r\\n\\tif (buf == NULL)\\r\\n\\t{\\tprintf (\\\"Error : Out of memory.\\\\n\\\\n\\\") ;\\r\\n\\t\\treturn 1 ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tframes = BLOCK_SIZE / channels ;\\r\\n\\r\\n\\twhile ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)\\r\\n\\t{\\tfor (k = 0 ; k < readcount ; k++)\\r\\n\\t\\t{\\tfor (m = 0 ; m < channels ; m++)\\r\\n\\t\\t\\t\\tif (full_precision)\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" %.*e\\\", OP_DBL_Digs - 1, buf [k * channels + m]) ;\\r\\n\\t\\t\\t\\telse\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" % 12.10f\\\", buf [k * channels + m]) ;\\r\\n\\t\\t\\tfprintf (outfile, \\\"\\\\n\\\") ;\\r\\n\\t\\t\\t} ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfree (buf) ;\\r\\n\\r\\n\\treturn 0 ;\\r\\n} /* convert_to_text */\\r\\n\\r\\nint\\r\\nmain (int argc, char * argv [])\\r\\n{\\tchar \\t\\t*progname, *infilename, *outfilename ;\\r\\n\\tSNDFILE\\t\\t*infile = NULL ;\\r\\n\\tFILE\\t\\t*outfile = NULL ;\\r\\n\\tSF_INFO\\t\\tsfinfo ;\\r\\n\\tint\\t\\tfull_precision = 0 ;\\r\\n\\tint \\tret = 1 ;\\r\\n\\r\\n\\tprogname = strrchr (argv [0], '/') ;\\r\\n\\tprogname = progname ? progname + 1 : argv [0] ;\\r\\n\\r\\n\\tswitch (argc)\\r\\n\\t{\\tcase 4 :\\r\\n\\t\\t\\tif (!strcmp (\\\"--full-precision\\\", argv [3]))\\r\\n\\t\\t\\t{\\tprint_usage (progname) ;\\r\\n\\t\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t\\t\\t} ;\\r\\n\\t\\t\\tfull_precision = 1 ;\\r\\n\\t\\t\\targv++ ;\\r\\n\\t\\tcase 3 :\\r\\n\\t\\t\\tbreak ;\\r\\n\\t\\tdefault:\\r\\n\\t\\t\\tprint_usage (progname) ;\\r\\n\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tinfilename = argv [1] ;\\r\\n\\toutfilename = argv [2] ;\\r\\n\\r\\n\\tif (strcmp (infilename, outfilename) == 0)\\r\\n\\t{\\tprintf (\\\"Error : Input and output filenames are the same.\\\\n\\\\n\\\") ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (infilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Input filename (%s) looks like an option.\\\\n\\\\n\\\", infilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (outfilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Output filename (%s) looks like an option.\\\\n\\\\n\\\", outfilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tmemset (&sfinfo, 0, sizeof (sfinfo)) ;\\r\\n\\r\\n\\tif ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open input file %s.\\\\n\\\", infilename) ;\\r\\n\\t\\tputs (sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\t/* Open the output file. */\\r\\n\\tif ((outfile = fopen (outfilename, \\\"w\\\")) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open output file %s : %s\\\\n\\\", outfilename, sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfprintf (outfile, \\\"# Converted from file %s.\\\\n\\\", infilename) ;\\r\\n\\tfprintf (outfile, \\\"# Channels %d, Sample rate %d\\\\n\\\", sfinfo.channels, sfinfo.samplerate) ;\\r\\n\\r\\n\\tret = convert_to_text (infile, outfile, sfinfo.channels, full_precision) ;\\r\\n\\r\\ncleanup :\\r\\n\\r\\n\\tsf_close (infile) ;\\r\\n\\tif (outfile != NULL)\\r\\n\\t\\tfclose (outfile) ;\\r\\n\\r\\n\\treturn ret ;\\r\\n} /* main */\\r\\n\",\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}}\r\n\r\nI[23:43:10.215] <-- textDocument/didOpen\r\n"
'V[23:43:10.215] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\n'
"I[23:43:10.215] <-- textDocument/semanticTokens/full(2)\r\n"
"V[23:43:10.216] config note at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Parsing config fragment\r\nE[23:43:10.216] config error at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Config should be a dictionary\r\nV[23:43:10.216] config note at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Parsed 0 fragments from file\r\n"
"I[23:43:10.216] --> textDocument/publishDiagnostics\r\n"
'V[23:43:10.216] >>> {"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:///C:/Users/USER/proj/sndfile-test/.clangd"}}\r\n\r\n'
"I[23:43:10.216] Loaded compilation database from C:\\Users\\USER\\proj\\sndfile-test\\build/compile_commands.json\r\n"
'I[23:43:10.216] ASTWorker building file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0 with command clangd fallback\r\n[C:\\Users\\USER\\proj\\sndfile-test]\r\n"C:\\\\msys64\\\\usr\\\\bin\\\\clang" "-resource-dir=C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -- "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\nV[23:43:10.216] Broadcasting compilation database from C:\\Users\\USER\\proj\\sndfile-test\r\n'
--> 'V[23:43:10.224] Driver produced command: cc1 -cc1 -triple x86_64-pc-windows-msvc19.33.0 -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic "-fdebug-compilation-dir=C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test" "-fcoverage-compilation-dir=C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test" -resource-dir "C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -internal-isystem "C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18\\\\include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 10.0/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 9.0/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 8/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include" -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.33 -fskip-odr-check-in-gmf -fdelayed-template-parsing -no-round-trip-args -faddrsig -x c "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
"V[23:43:10.224] Building first preamble for C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0\r\n"
"I[23:43:10.234] Built preamble of size 238116 for file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0 in 0.01 seconds\r\n"
"I[23:43:10.234] --> workspace/semanticTokens/refresh(0)\r\n"
'V[23:43:10.234] >>> {"id":0,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}\r\n\r\n'
'V[23:43:10.234] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}\r\n\r\nI[23:43:10.234] <-- $/cancelRequest\r\n'
'V[23:43:10.234] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[23:43:10.234] <-- textDocument/semanticTokens/full(3)\r\n'
'V[23:43:10.234] <<< {"id":0,"jsonrpc":"2.0","result":null}\r\n\r\nI[23:43:10.235] <-- reply(0)\r\n'
"V[23:43:10.235] indexed preamble AST for C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0:\r\n  symbol slab: 42 symbols, 13968 bytes\r\n  ref slab: 0 symbols, 0 refs, 136 bytes\r\n  relations slab: 0 relations, 24 bytes\r\n"
"V[23:43:10.235] Build dynamic index for header symbols with estimated memory usage of 61784 bytes\r\n"
'V[23:43:10.249] Trying to fix unresolved name "puts" in scopes: []\r\nV[23:43:10.249] Dex query tree: false\r\n'
'V[23:43:10.249] Trying to fix unresolved name "SNDFILE" in scopes: []\r\n'
"V[23:43:10.249] Dex query tree: false\r\n"
'V[23:43:10.249] Trying to fix unresolved name "FILE" in scopes: []\r\nV[23:43:10.249] Dex query tree: false\r\n'
'V[23:43:10.250] Trying to fix unresolved name "sf_count_t" in scopes: []\r\nV[23:43:10.250] Dex query tree: false\r\n'
'V[23:43:10.250] Trying to fix unresolved name "NULL" in scopes: []\r\nV[23:43:10.250] Dex query tree: false\r\n'
'V[23:43:10.250] Trying to fix unresolved name "frames" in scopes: []\r\n'
'V[23:43:10.250] Trying to fix unresolved name "sf_readf_float" in scopes: []\r\n'
'V[23:43:10.250] Trying to fix unresolved name "frames" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "fprintf" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "SNDFILE" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "infile" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "NULL" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "FILE" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "outfile" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "NULL" in scopes: []\r\n'
'V[23:43:10.251] Trying to fix unresolved name "SF_INFO" in scopes: []\r\n'
"E[23:43:10.252] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:43:10.252] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:43:10.252] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:43:10.252] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:43:10.252] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:43:10.252] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"V[23:43:10.253] indexed file AST for C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0:\r\n  symbol slab: 5 symbols, 5384 bytes\r\n  ref slab: 6 symbols, 15 refs, 4376 bytes\r\n  relations slab: 0 relations, 24 bytes\r\nV[23:43:10.253] Build dynamic index for main-file symbols with estimated memory usage of 13960 bytes\r\n"
"I[23:43:10.254] --> textDocument/publishDiagnostics\r\nV[23:43:10.254] >>> {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/publishDiagnostics\",\"params\":{\"diagnostics\":[{\"code\":\"pp_file_not_found\",\"message\":\"'stdio.h' file not found\",\"range\":{\"end\":{\"character\":18,\"line\":0},\"start\":{\"character\":9,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":8,\"line\":22},\"start\":{\"character\":2,\"line\":22}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":8,\"line\":22},\"start\":{\"character\":2,\"line\":22}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdio.h> or explicitly provide a declaration for 'printf'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'puts'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":5,\"line\":23},\"start\":{\"character\":1,\"line\":23}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unknown_typename\",\"message\":\"Unknown type name 'SNDFILE'\",\"range\":{\"end\":{\"character\":24,\"line\":31},\"start\":{\"character\":17,\"line\":31}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unknown_typename\",\"message\":\"Unknown type name 'FILE'\",\"range\":{\"end\":{\"character\":39,\"line\":31},\"start\":{\"character\":35,\"line\":31}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'sf_count_t'\",\"range\":{\"end\":{\"character\":11,\"line\":33},\"start\":{\"character\":1,\"line\":33}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'malloc' with type 'void *(unsigned long long)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":13,\"line\":36},\"start\":{\"character\":7,\"line\":36}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":13,\"line\":36},\"start\":{\"character\":7,\"line\":36}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdlib.h> or explicitly provide a declaration for 'malloc'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":16,\"line\":37},\"start\":{\"character\":12,\"line\":37}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'frames'\",\"range\":{\"end\":{\"character\":7,\"line\":42},\"start\":{\"character\":1,\"line\":42}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'sf_readf_float'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":41,\"line\":44},\"start\":{\"character\":27,\"line\":44}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'frames'\",\"range\":{\"end\":{\"character\":62,\"line\":44},\"start\":{\"character\":56,\"line\":44}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'fprintf'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":12,\"line\":48},\"start\":{\"character\":5,\"line\":48}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wbuiltin-requires-header\",\"message\":\"Declaration of built-in function 'fprintf' requires inclusion of the header <stdio.h>\",\"range\":{\"end\":{\"character\":12,\"line\":48},\"start\":{\"character\":5,\"line\":48}},\"relatedInformation\":[],\"severity\":2,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'free' with type 'void (void *)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":5,\"line\":55},\"start\":{\"character\":1,\"line\":55}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":5,\"line\":55},\"start\":{\"character\":1,\"line\":55}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdlib.h> or explicitly provide a declaration for 'free'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'SNDFILE'\",\"range\":{\"end\":{\"character\":8,\"line\":63},\"start\":{\"character\":1,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'infile'\",\"range\":{\"end\":{\"character\":17,\"line\":63},\"start\":{\"character\":11,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":24,\"line\":63},\"start\":{\"character\":20,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'FILE'\",\"range\":{\"end\":{\"character\":5,\"line\":64},\"start\":{\"character\":1,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'outfile'\",\"range\":{\"end\":{\"character\":15,\"line\":64},\"start\":{\"character\":8,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":22,\"line\":64},\"start\":{\"character\":18,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'SF_INFO'\",\"range\":{\"end\":{\"character\":8,\"line\":65},\"start\":{\"character\":1,\"line\":65}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"fatal_too_many_errors\",\"message\":\"Too many errors emitted, stopping now\",\"range\":{\"end\":{\"character\":0,\"line\":0},\"start\":{\"character\":0,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"}],\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}\r\n\r\n"
'I[23:43:10.254] --> reply:textDocument/semanticTokens/full(2) 38 ms, error: Task was cancelled.\r\nV[23:43:10.254] >>> {"error":{"code":-32800,"message":"Request cancelled"},"id":2,"jsonrpc":"2.0"}\r\n\r\nV[23:43:10.254] ASTWorker running SemanticHighlights on version 0 of C:\\Users\\USER\\proj\\sndfile-test\\main.c\r\nI[23:43:10.254] --> reply:textDocument/semanticTokens/full(3) 19 ms\r\nV[23:43:10.254] >>> {"id":3,"jsonrpc":"2.0","result":{"data":[8,8,10,19,131073,2,7,15,19,131072,1,9,11,19,131073,0,13,15,19,131072,2,0,20,24,0,1,0,36,24,0,1,0,7,24,0,1,0,36,24,0,1,0,8,24,0,4,0,11,3,65539,0,19,8,2,16387,1,2,6,3,131072,0,72,8,2,16384,1,1,4,3,131072,8,0,15,3,65539,0,27,6,2,16387,0,15,7,2,16387,0,13,8,2,16387,0,14,14,2,16387,1,9,3,1,16387,2,5,1,1,16387,0,3,1,1,16387,0,3,9,1,16387,2,1,3,1,16384,0,4,1,21,0,0,2,6,3,131072,0,8,10,19,131072,0,11,1,21,0,1,5,3,1,16384,0,4,2,21,8192,1,3,6,3,131072,4,10,10,19,131072,3,8,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,9,1,16384,0,12,1,1,16384,0,1,2,21,0,1,9,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,11,1,1,16384,0,1,2,21,0,1,8,14,2,16384,1,5,7,3,131072,0,27,11,19,131072,0,12,1,21,0,0,5,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,2,5,7,3,131072,0,31,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,1,3,7,3,131072,4,1,4,3,131072,0,6,3,1,18432,6,0,4,3,131075,0,10,4,2,16387,0,13,4,2,16387,1,10,8,1,16387,0,11,10,1,16387,0,13,11,1,16387,4,6,14,1,16387,1,6,3,1,16387,2,1,8,1,16384,0,9,1,21,0,0,2,7,3,131072,0,9,4,2,16384,1,1,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,4,1,21,0,0,2,4,2,16384,2,9,4,2,16384,2,7,1,21,0,0,1,6,3,131072,0,28,4,2,16384,1,5,11,3,65536,0,13,8,1,18432,1,9,7,23,16384,2,3,14,1,16384,0,15,1,21,0,1,3,4,2,16384,0,4,2,21,0,4,3,11,3,65536,0,13,8,1,18432,1,8,7,23,16384,3,1,10,1,16384,0,11,1,21,0,0,2,4,2,16384,1,1,11,1,16384,0,12,1,21,0,0,2,4,2,16384,2,5,6,3,131072,0,8,10,1,16384,0,12,11,1,16384,0,13,2,21,0,1,3,6,3,131072,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,10,1,16384,0,15,2,21,0,1,3,6,3,131072,0,65,10,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,11,1,16384,0,16,2,21,0,1,3,6,3,131072,0,66,11,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,6,3,6,3,131072,0,45,10,1,16384,2,7,7,23,16384,6,7,7,23,16384,8,0,7,23,16385,6,8,3,1,16384],"resultId":"1"}}\r\n\r\n'

Here is the log AFTER --query-driver=C:\msys64\usr\bin\clang.exe with verbose logging. There is indeed a change noted where the arrow is located but clangd still cannot do the parsing correctly. Anything else you can spot? Do you think the visual studio files are interfering?

[ERROR][2024-07-08 23:49:49] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    'V[23:49:49.631] <<< {"id":4,"jsonrpc":"2.0","method":"shutdown"}\r\n\r\nI[23:49:49.631] <-- shutdown(4)\r\nI[23:49:49.631] --> reply:shutdown(4) 0 ms\r\nV[23:49:49.631] >>> {"id":4,"jsonrpc":"2.0","result":null}\r\n\r\n'
[ERROR][2024-07-08 23:49:49] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    'V[23:49:49.632] <<< {"jsonrpc":"2.0","method":"exit"}\r\n\r\nI[23:49:49.632] <-- exit\r\nI[23:49:49.632] LSP finished, exiting with status 0\r\n'
[ERROR][2024-07-08 23:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    "I[23:49:50.163] clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)\r\nI[23:49:50.164] Features: windows+grpc\r\nI[23:49:50.164] PID: 7524\r\n"
[ERROR][2024-07-08 23:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    "I[23:49:50.164] Working directory: C:\\Users\\USER\\proj\\sndfile-test\r\nI[23:49:50.164] argv[0]: C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\packages\\clangd\\clangd_18.1.3\\bin\\clangd.exe\r\nI[23:49:50.164] argv[1]: --log=verbose\r\nI[23:49:50.164] argv[2]: --query-driver=C:\\msys64\\usr\\bin\\clang.exe\r\n"
"V[23:49:50.168] User config file is C:\\Users\\USER\\AppData\\Local\\clangd\\config.yaml\r\nI[23:49:50.168] Starting LSP over stdin/stdout\r\n"
'V[23:49:50.168] <<< {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"dynamicRegistration":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"snippetSupport":false},"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":false,"dynamicRegistration":false,"editsNearCursor":true},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":false,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":true,"requests":{"full":{"delta":true},"range":false},"serverCancelSupport":false,"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","decorator"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"linkSupport":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}},"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":false,"relativePatternSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":false,"hierarchicalWorkspaceSymbolSupport":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]}},"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Neovim","version":"0.9.5"},"initializationOptions":{},"processId":7192,"rootPath":"C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test","rootUri":"file:///C:/Users/USER/proj/sndfile-test","trace":"off","workspaceFolders":[{"name":"C:/Users/USER/proj/sndfile-test","uri":"file:///C:/Users/USER/proj/sndfile-test"}]}}\r\n\r\nI[23:49:50.168] <-- initialize(1)\r\n'
"I[23:49:50.170] --> reply:initialize(1) 1 ms\r\n"
'V[23:49:50.170] >>> {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":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"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","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","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"offsetEncoding":"utf-8","serverInfo":{"name":"clangd","version":"clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0) windows+grpc x86_64-pc-windows-msvc"}}}\r\n\r\n'
'V[23:49:50.170] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}\r\n\r\nI[23:49:50.170] <-- initialized\r\n'
"V[23:49:50.170] <<< {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didOpen\",\"params\":{\"textDocument\":{\"languageId\":\"c\",\"text\":\"#include <stdio.h>\\r\\n#include <stdlib.h>\\r\\n#include <string.h>\\r\\n#include <ctype.h>\\r\\n#include <float.h>\\r\\n#include \\\"header.h\\\"\\r\\n#include <sndfile.h>\\r\\n\\r\\n#define\\tBLOCK_SIZE 4096\\r\\n\\r\\n#ifdef DBL_DECIMAL_DIG\\r\\n\\t#define OP_DBL_Digs (DBL_DECIMAL_DIG)\\r\\n#else\\r\\n\\t#ifdef DECIMAL_DIG\\r\\n\\t\\t#define OP_DBL_Digs (DECIMAL_DIG)\\r\\n\\t#else\\r\\n\\t\\t#define OP_DBL_Digs (DBL_DIG + 3)\\r\\n\\t#endif\\r\\n#endif\\r\\n\\r\\nstatic void\\r\\nprint_usage (char *progname)\\r\\n{\\tprintf (\\\"\\\\nUsage : %s [--full-precision] <input file> <output file>\\\\n\\\", progname) ;\\r\\n\\tputs (\\\"\\\\n\\\"\\r\\n\\t\\t\\\"    Where the output file will contain a line for each frame\\\\n\\\"\\r\\n\\t\\t\\\"    and a column for each channel.\\\\n\\\"\\r\\n\\t\\t) ;\\r\\n\\r\\n} /* print_usage */\\r\\n\\r\\nstatic int\\r\\nconvert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precision)\\r\\n{\\tfloat *buf ;\\r\\n\\tsf_count_t frames ;\\r\\n\\tint k, m, readcount ;\\r\\n\\r\\n\\tbuf = malloc (BLOCK_SIZE * sizeof (float)) ;\\r\\n\\tif (buf == NULL)\\r\\n\\t{\\tprintf (\\\"Error : Out of memory.\\\\n\\\\n\\\") ;\\r\\n\\t\\treturn 1 ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tframes = BLOCK_SIZE / channels ;\\r\\n\\r\\n\\twhile ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)\\r\\n\\t{\\tfor (k = 0 ; k < readcount ; k++)\\r\\n\\t\\t{\\tfor (m = 0 ; m < channels ; m++)\\r\\n\\t\\t\\t\\tif (full_precision)\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" %.*e\\\", OP_DBL_Digs - 1, buf [k * channels + m]) ;\\r\\n\\t\\t\\t\\telse\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" % 12.10f\\\", buf [k * channels + m]) ;\\r\\n\\t\\t\\tfprintf (outfile, \\\"\\\\n\\\") ;\\r\\n\\t\\t\\t} ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfree (buf) ;\\r\\n\\r\\n\\treturn 0 ;\\r\\n} /* convert_to_text */\\r\\n\\r\\nint\\r\\nmain (int argc, char * argv [])\\r\\n{\\tchar \\t\\t*progname, *infilename, *outfilename ;\\r\\n\\tSNDFILE\\t\\t*infile = NULL ;\\r\\n\\tFILE\\t\\t*outfile = NULL ;\\r\\n\\tSF_INFO\\t\\tsfinfo ;\\r\\n\\tint\\t\\tfull_precision = 0 ;\\r\\n\\tint \\tret = 1 ;\\r\\n\\r\\n\\tprogname = strrchr (argv [0], '/') ;\\r\\n\\tprogname = progname ? progname + 1 : argv [0] ;\\r\\n\\r\\n\\tswitch (argc)\\r\\n\\t{\\tcase 4 :\\r\\n\\t\\t\\tif (!strcmp (\\\"--full-precision\\\", argv [3]))\\r\\n\\t\\t\\t{\\tprint_usage (progname) ;\\r\\n\\t\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t\\t\\t} ;\\r\\n\\t\\t\\tfull_precision = 1 ;\\r\\n\\t\\t\\targv++ ;\\r\\n\\t\\tcase 3 :\\r\\n\\t\\t\\tbreak ;\\r\\n\\t\\tdefault:\\r\\n\\t\\t\\tprint_usage (progname) ;\\r\\n\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tinfilename = argv [1] ;\\r\\n\\toutfilename = argv [2] ;\\r\\n\\r\\n\\tif (strcmp (infilename, outfilename) == 0)\\r\\n\\t{\\tprintf (\\\"Error : Input and output filenames are the same.\\\\n\\\\n\\\") ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (infilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Input filename (%s) looks like an option.\\\\n\\\\n\\\", infilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (outfilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Output filename (%s) looks like an option.\\\\n\\\\n\\\", outfilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tmemset (&sfinfo, 0, sizeof (sfinfo)) ;\\r\\n\\r\\n\\tif ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open input file %s.\\\\n\\\", infilename) ;\\r\\n\\t\\tputs (sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\t/* Open the output file. */\\r\\n\\tif ((outfile = fopen (outfilename, \\\"w\\\")) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open output file %s : %s\\\\n\\\", outfilename, sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfprintf (outfile, \\\"# Converted from file %s.\\\\n\\\", infilename) ;\\r\\n\\tfprintf (outfile, \\\"# Channels %d, Sample rate %d\\\\n\\\", sfinfo.channels, sfinfo.samplerate) ;\\r\\n\\r\\n\\tret = convert_to_text (infile, outfile, sfinfo.channels, full_precision) ;\\r\\n\\r\\ncleanup :\\r\\n\\r\\n\\tsf_close (infile) ;\\r\\n\\tif (outfile != NULL)\\r\\n\\t\\tfclose (outfile) ;\\r\\n\\r\\n\\treturn ret ;\\r\\n} /* main */\\r\\n\",\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}}\r\n\r\nI[23:49:50.170] <-- textDocument/didOpen\r\n"
"V[23:49:50.171] System include extraction: driver clang expanded to C:\\msys64\\usr\\bin\\clang.exe\r\n"
'V[23:49:50.200] System include extraction: target extracted: "x86_64-pc-windows-msys"\r\nV[23:49:50.200] System include extraction: adding  /usr/local/include\r\nV[23:49:50.200] System include extraction: adding  /usr/lib/clang/11.0.0/include\r\nV[23:49:50.200] System include extraction: adding  /usr/include/w32api\r\nV[23:49:50.200] System include extraction: adding  /usr/include\r\n'
'I[23:49:50.224] System includes extractor: successfully executed C:\\msys64\\usr\\bin\\clang.exe\r\n\tgot includes: "/usr/local/include, /usr/lib/clang/11.0.0/include, /usr/include/w32api, /usr/include"\r\n\tgot target: "x86_64-pc-windows-msys"\r\n'
'V[23:49:50.224] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[23:49:50.224] <-- textDocument/semanticTokens/full(2)\r\n'
"V[23:49:50.224] config note at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Parsing config fragment\r\nE[23:49:50.224] config error at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Config should be a dictionary\r\nV[23:49:50.224] config note at C:\\Users\\USER\\proj\\sndfile-test\\.clangd:1:0: Parsed 0 fragments from file\r\n"
'I[23:49:50.225] --> textDocument/publishDiagnostics\r\nV[23:49:50.225] >>> {"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:///C:/Users/USER/proj/sndfile-test/.clangd"}}\r\n\r\n'
'I[23:49:50.225] Loaded compilation database from C:\\Users\\USER\\proj\\sndfile-test\\build/compile_commands.json\r\nV[23:49:50.225] Broadcasting compilation database from C:\\Users\\USER\\proj\\sndfile-test\r\nI[23:49:50.225] ASTWorker building file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0 with command clangd fallback\r\n[C:\\Users\\USER\\proj\\sndfile-test]\r\n"C:\\\\msys64\\\\usr\\\\bin\\\\clang" -isystem /usr/local/include -isystem /usr/lib/clang/11.0.0/include -isystem /usr/include/w32api -isystem /usr/include --target=x86_64-pc-windows-msys "-resource-dir=C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -- "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
--> 'V[23:49:50.232] Driver produced command: cc1 -cc1 -triple x86_64-pc-windows-msvc19.33.0 -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic "-fdebug-compilation-dir=C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test" "-fcoverage-compilation-dir=C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test" -resource-dir "C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18" -isystem /usr/local/include -isystem /usr/lib/clang/11.0.0/include -isystem /usr/include/w32api -isystem /usr/include -internal-isystem "C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\nvim-data\\\\mason\\\\packages\\\\clangd\\\\clangd_18.1.3\\\\lib\\\\clang\\\\18\\\\include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 10.0/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 9.0/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 8/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include" -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.33 -fskip-odr-check-in-gmf -fdelayed-template-parsing -no-round-trip-args -faddrsig -x c "C:\\\\Users\\\\USER\\\\proj\\\\sndfile-test\\\\main.c"\r\n'
"V[23:49:50.232] Building first preamble for C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0\r\n"
"I[23:49:50.241] Built preamble of size 238244 for file C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0 in 0.01 seconds\r\n"
"I[23:49:50.241] --> workspace/semanticTokens/refresh(0)\r\n"
'V[23:49:50.241] >>> {"id":0,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}\r\n\r\n'
'V[23:49:50.241] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}\r\n\r\nI[23:49:50.241] <-- $/cancelRequest\r\nV[23:49:50.241] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[23:49:50.241] <-- textDocument/semanticTokens/full(3)\r\n'
'V[23:49:50.241] <<< {"id":0,"jsonrpc":"2.0","result":null}\r\n\r\nI[23:49:50.241] <-- reply(0)\r\n'
"V[23:49:50.241] indexed preamble AST for C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0:\r\n  symbol slab: 42 symbols, 13968 bytes\r\n  ref slab: 0 symbols, 0 refs, 136 bytes\r\n  relations slab: 0 relations, 24 bytes\r\n"
"V[23:49:50.242] Build dynamic index for header symbols with estimated memory usage of 61784 bytes\r\n"
'V[23:49:50.255] Trying to fix unresolved name "puts" in scopes: []\r\nV[23:49:50.255] Dex query tree: false\r\n'
'V[23:49:50.255] Trying to fix unresolved name "SNDFILE" in scopes: []\r\n'
"V[23:49:50.255] Dex query tree: false\r\n"
'V[23:49:50.255] Trying to fix unresolved name "FILE" in scopes: []\r\n'
"V[23:49:50.255] Dex query tree: false\r\n"
'V[23:49:50.255] Trying to fix unresolved name "sf_count_t" in scopes: []\r\n'
"V[23:49:50.255] Dex query tree: false\r\n"
'V[23:49:50.255] Trying to fix unresolved name "NULL" in scopes: []\r\n'
"V[23:49:50.255] Dex query tree: false\r\n"
'V[23:49:50.256] Trying to fix unresolved name "frames" in scopes: []\r\n'
'V[23:49:50.256] Trying to fix unresolved name "sf_readf_float" in scopes: []\r\n'
'V[23:49:50.256] Trying to fix unresolved name "frames" in scopes: []\r\n'
'V[23:49:50.256] Trying to fix unresolved name "fprintf" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "SNDFILE" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "infile" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "NULL" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "FILE" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "outfile" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "NULL" in scopes: []\r\n'
'V[23:49:50.257] Trying to fix unresolved name "SF_INFO" in scopes: []\r\n'
"E[23:49:50.258] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:49:50.258] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:49:50.258] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:49:50.258] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:49:50.258] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\nE[23:49:50.258] IncludeCleaner: Failed to get an entry for resolved path : no such file or directory\r\n"
"V[23:49:50.259] indexed file AST for C:\\Users\\USER\\proj\\sndfile-test\\main.c version 0:\r\n  symbol slab: 5 symbols, 5384 bytes\r\n  ref slab: 6 symbols, 15 refs, 4376 bytes\r\n  relations slab: 0 relations, 24 bytes\r\nV[23:49:50.259] Build dynamic index for main-file symbols with estimated memory usage of 13960 bytes\r\n"
"I[23:49:50.260] --> textDocument/publishDiagnostics\r\n"
"V[23:49:50.260] >>> {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/publishDiagnostics\",\"params\":{\"diagnostics\":[{\"code\":\"pp_file_not_found\",\"message\":\"'stdio.h' file not found\",\"range\":{\"end\":{\"character\":18,\"line\":0},\"start\":{\"character\":9,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":8,\"line\":22},\"start\":{\"character\":2,\"line\":22}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":8,\"line\":22},\"start\":{\"character\":2,\"line\":22}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdio.h> or explicitly provide a declaration for 'printf'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'puts'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":5,\"line\":23},\"start\":{\"character\":1,\"line\":23}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unknown_typename\",\"message\":\"Unknown type name 'SNDFILE'\",\"range\":{\"end\":{\"character\":24,\"line\":31},\"start\":{\"character\":17,\"line\":31}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unknown_typename\",\"message\":\"Unknown type name 'FILE'\",\"range\":{\"end\":{\"character\":39,\"line\":31},\"start\":{\"character\":35,\"line\":31}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'sf_count_t'\",\"range\":{\"end\":{\"character\":11,\"line\":33},\"start\":{\"character\":1,\"line\":33}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'malloc' with type 'void *(unsigned long long)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":13,\"line\":36},\"start\":{\"character\":7,\"line\":36}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":13,\"line\":36},\"start\":{\"character\":7,\"line\":36}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdlib.h> or explicitly provide a declaration for 'malloc'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":16,\"line\":37},\"start\":{\"character\":12,\"line\":37}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'frames'\",\"range\":{\"end\":{\"character\":7,\"line\":42},\"start\":{\"character\":1,\"line\":42}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'sf_readf_float'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":41,\"line\":44},\"start\":{\"character\":27,\"line\":44}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'frames'\",\"range\":{\"end\":{\"character\":62,\"line\":44},\"start\":{\"character\":56,\"line\":44}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'fprintf'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":12,\"line\":48},\"start\":{\"character\":5,\"line\":48}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wbuiltin-requires-header\",\"message\":\"Declaration of built-in function 'fprintf' requires inclusion of the header <stdio.h>\",\"range\":{\"end\":{\"character\":12,\"line\":48},\"start\":{\"character\":5,\"line\":48}},\"relatedInformation\":[],\"severity\":2,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'free' with type 'void (void *)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":5,\"line\":55},\"start\":{\"character\":1,\"line\":55}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":5,\"line\":55},\"start\":{\"character\":1,\"line\":55}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdlib.h> or explicitly provide a declaration for 'free'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'SNDFILE'\",\"range\":{\"end\":{\"character\":8,\"line\":63},\"start\":{\"character\":1,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'infile'\",\"range\":{\"end\":{\"character\":17,\"line\":63},\"start\":{\"character\":11,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":24,\"line\":63},\"start\":{\"character\":20,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'FILE'\",\"range\":{\"end\":{\"character\":5,\"line\":64},\"start\":{\"character\":1,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'outfile'\",\"range\":{\"end\":{\"character\":15,\"line\":64},\"start\":{\"character\":8,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":22,\"line\":64},\"start\":{\"character\":18,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'SF_INFO'\",\"range\":{\"end\":{\"character\":8,\"line\":65},\"start\":{\"character\":1,\"line\":65}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"fatal_too_many_errors\",\"message\":\"Too many errors emitted, stopping now\",\"range\":{\"end\":{\"character\":0,\"line\":0},\"start\":{\"character\":0,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"}],\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}\r\n\r\nI[23:49:50.260] --> reply:textDocument/semanticTokens/full(2) 36 ms, error: Task was cancelled.\r\nV[23:49:50.260] >>> {\"error\":{\"code\":-32800,\"message\":\"Request cancelled\"},\"id\":2,\"jsonrpc\":\"2.0\"}\r\n\r\nV[23:49:50.260] ASTWorker running SemanticHighlights on version 0 of C:\\Users\\USER\\proj\\sndfile-test\\main.c\r\nI[23:49:50.260] --> reply:textDocument/semanticTokens/full(3) 18 ms\r\nV[23:49:50.260] >>> {\"id\":3,\"jsonrpc\":\"2.0\",\"result\":{\"data\":[8,8,10,19,131073,2,7,15,19,131072,1,9,11,19,131073,0,13,15,19,131072,2,0,20,24,0,1,0,36,24,0,1,0,7,24,0,1,0,36,24,0,1,0,8,24,0,4,0,11,3,65539,0,19,8,2,16387,1,2,6,3,131072,0,72,8,2,16384,1,1,4,3,131072,8,0,15,3,65539,0,27,6,2,16387,0,15,7,2,16387,0,13,8,2,16387,0,14,14,2,16387,1,9,3,1,16387,2,5,1,1,16387,0,3,1,1,16387,0,3,9,1,16387,2,1,3,1,16384,0,4,1,21,0,0,2,6,3,131072,0,8,10,19,131072,0,11,1,21,0,1,5,3,1,16384,0,4,2,21,8192,1,3,6,3,131072,4,10,10,19,131072,3,8,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,9,1,16384,0,12,1,1,16384,0,1,2,21,0,1,9,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,11,1,1,16384,0,1,2,21,0,1,8,14,2,16384,1,5,7,3,131072,0,27,11,19,131072,0,12,1,21,0,0,5,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,2,5,7,3,131072,0,31,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,1,3,7,3,131072,4,1,4,3,131072,0,6,3,1,18432,6,0,4,3,131075,0,10,4,2,16387,0,13,4,2,16387,1,10,8,1,16387,0,11,10,1,16387,0,13,11,1,16387,4,6,14,1,16387,1,6,3,1,16387,2,1,8,1,16384,0,9,1,21,0,0,2,7,3,131072,0,9,4,2,16384,1,1,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,4,1,21,0,0,2,4,2,16384,2,9,4,2,16384,2,7,1,21,0,0,1,6,3,131072,0,28,4,2,16384,1,5,11,3,65536,0,13,8,1,18432,1,9,7,23,16384,2,3,14,1,16384,0,15,1,21,0,1,3,4,2,16384,0,4,2,21,0,4,3,11,3,65536,0,13,8,1,18432,1,8,7,23,16384,3,1,10,1,16384,0,11,1,21,0,0,2,4,2,16384,1,1,11,1,16384,0,12,1,21,0,0,2,4,2,16384,2,5,6,3,131072,0,8,10,1,16384,0,12,11,1,16384,0,13,2,21,0,1,3,6,3,131072,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,10,1,16384,0,15,2,21,0,1,3,6,3,131072,0,65,10,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,11,1,16384,0,16,2,21,0,1,3,6,3,131072,0,66,11,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,6,3,6,3,131072,0,45,10,1,16384,2,7,7,23,16384,6,7,7,23,16384,8,0,7,23,16385,6,8,3,1,16384],\"resultId\":\"1\"}}\r\n\r\n"

Any other input? Thank you again! I really appreciate it and I hope I can finally start a project using clangd. I've been debugging it on my own for a while.

EDIT: By the way the SNDFILE stuff is an external library, do I have to also add that path somewhere? It doesn't seem to find it but the project does build. Maybe I need to add some PATHs?

HighCommander4 commented 3 months ago

Ah, my bad, I think I confused MinGW and MSYS in my mind. --query-driver solves this issue for MinGW users.

MSYS is a bit more special, I think what has worked in that case is to use the clangd from the package prepared by MSYS at https://packages.msys2.org/package/mingw-w64-x86_64-clang-tools-extra.

HighCommander4 commented 3 months ago

To expand on that a bit, the relevant line of the log is this:

I[23:49:50.224] System includes extractor: successfully executed C:\\msys64\\usr\\bin\\clang.exe
    got includes: "/usr/local/include, /usr/lib/clang/11.0.0/include, /usr/include/w32api, /usr/include"
    got target: "x86_64-pc-windows-msys"\r\n

You can see that the include paths found by --query-driver have the format /usr/local/include, these are basically paths "inside" the emulation layer of MSYS. A "regular" clangd executable does not know how to locate these paths, only a clangd executable packaged as part of MSYS does.

ymich9963 commented 3 months ago

Wow!!!! This is amazing!!! You were right I had to download the MSYS2 clang tools extra package, instead of using the one directly downloaded by mason.nvim!!! The --query-driver isn't needed, I just had to edit the file in C:\Users\USER\AppData\Local\nvim-data\mason\bin\clangd.cmd to point to the MSYS2 package clangd like so,

@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "C:/msys64/clang64/bin/clangd.exe" %*

I'm using the /clang64 environment, but it should work under any environment you can get CLang from. Make sure the correct environment is in the PATH as well! (This is to anyone having this problem)

Last thing! Clangd doesn't seem to recognise the header files in the project tree. Right now it looks like this,

C:.
|   CMakeLists.txt
|   main.c
|
+---inc
|       header.h
|
\---src
        CMakeLists.txt
        other1.c

and this is my compile_commands.json,

[
{
  "directory": "/c/Users/USER/proj/sndfile-test/build",
  "command": "/clang64/bin/clang.exe  -I/c/Users/USER/proj/sndfile-test/inc -isystem /clang64/include  -o CMakeFiles/test.dir/main.c.o -c /c/Users/USER/proj/sndfile-test/main.c",
  "file": "/c/Users/USER/proj/sndfile-test/main.c",
  "output": "CMakeFiles/test.dir/main.c.o"
},
{
  "directory": "/c/Users/USER/proj/sndfile-test/build/src",
  "command": "/clang64/bin/clang.exe  -I/c/Users/USER/proj/sndfile-test/src/../inc  -o CMakeFiles/src.dir/other1.c.o -c /c/Users/USER/proj/sndfile-test/src/other1.c",
  "file": "/c/Users/USER/proj/sndfile-test/src/other1.c",
  "output": "src/CMakeFiles/src.dir/other1.c.o"
}
]

It says "header.h not found". Any ideas as to why clangd can't locate the header file under /inc?

HighCommander4 commented 3 months ago

Any ideas as to why clangd can't locate the header file under /inc?

Nothing obvious jumps out, can you post a set of updated logs?

ymich9963 commented 3 months ago

Of course! Here you go,

'V[22:37:06.584] <<< {"id":4,"jsonrpc":"2.0","method":"shutdown"}\r\n\r\nI[22:37:06.584] <-- shutdown(4)\r\nI[22:37:06.584] --> reply:shutdown(4) 0 ms\r\nV[22:37:06.584] >>> {"id":4,"jsonrpc":"2.0","result":null}\r\n\r\n'
'V[22:37:06.584] <<< {"jsonrpc":"2.0","method":"exit"}\r\n\r\nI[22:37:06.584] <-- exit\r\nI[22:37:06.584] LSP finished, exiting with status 0\r\n'
"I[22:37:07.130] clangd version 18.1.4\r\nI[22:37:07.131] Features: windows\r\nI[22:37:07.131] PID: 17788\r\nI[22:37:07.131] Working directory: C:/Users/USER/proj/sndfile-test\r\n"
"I[22:37:07.131] argv[0]: C:/msys64/clang64/bin/clangd.exe\r\nI[22:37:07.131] argv[1]: --log=verbose\r\n"
"V[22:37:07.133] User config file is C:/Users/USER/AppData/Local/clangd/config.yaml\r\nI[22:37:07.133] Starting LSP over stdin/stdout\r\n"
'V[22:37:07.133] <<< {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"dynamicRegistration":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"snippetSupport":false},"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":false,"dynamicRegistration":false,"editsNearCursor":true},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":false,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":true,"requests":{"full":{"delta":true},"range":false},"serverCancelSupport":false,"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","decorator"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"linkSupport":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}},"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":false,"relativePatternSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":false,"hierarchicalWorkspaceSymbolSupport":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]}},"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Neovim","version":"0.9.5"},"initializationOptions":{},"processId":4200,"rootPath":null,"rootUri":null,"trace":"off","workspaceFolders":null}}\r\n\r\n'
"I[22:37:07.133] <-- initialize(1)\r\n"
'I[22:37:07.135] --> reply:initialize(1) 1 ms\r\nV[22:37:07.135] >>> {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":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"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","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","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"offsetEncoding":"utf-8","serverInfo":{"name":"clangd","version":"clangd version 18.1.4 windows x86_64-w64-windows-gnu"}}}\r\n\r\n'
'V[22:37:07.135] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}\r\n\r\nI[22:37:07.135] <-- initialized\r\n'
"V[22:37:07.136] <<< {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didOpen\",\"params\":{\"textDocument\":{\"languageId\":\"c\",\"text\":\"#include <stdio.h>\\r\\n#include <stdlib.h>\\r\\n#include <string.h>\\r\\n#include <ctype.h>\\r\\n#include <float.h>\\r\\n#include \\\"header.h\\\"\\r\\n#include <sndfile.h>\\r\\n\\r\\n#define\\tBLOCK_SIZE 4096\\r\\n\\r\\n#ifdef DBL_DECIMAL_DIG\\r\\n\\t#define OP_DBL_Digs (DBL_DECIMAL_DIG)\\r\\n#else\\r\\n\\t#ifdef DECIMAL_DIG\\r\\n\\t\\t#define OP_DBL_Digs (DECIMAL_DIG)\\r\\n\\t#else\\r\\n\\t\\t#define OP_DBL_Digs (DBL_DIG + 3)\\r\\n\\t#endif\\r\\n#endif\\r\\n\\r\\nstatic void\\r\\nprint_usage (char *progname)\\r\\n{\\tprintf (\\\"\\\\nUsage : %s [--full-precision] <input file> <output file>\\\\n\\\", progname) ;\\r\\n\\tputs (\\\"\\\\n\\\"\\r\\n\\t\\t\\\"    Where the output file will contain a line for each frame\\\\n\\\"\\r\\n\\t\\t\\\"    and a column for each channel.\\\\n\\\"\\r\\n\\t\\t) ;\\r\\n\\r\\n} /* print_usage */\\r\\n\\r\\nstatic int\\r\\nconvert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precision)\\r\\n{\\tfloat *buf ;\\r\\n\\tsf_count_t frames ;\\r\\n\\tint k, m, readcount ;\\r\\n\\r\\n\\tbuf = malloc (BLOCK_SIZE * sizeof (float)) ;\\r\\n\\tif (buf == NULL)\\r\\n\\t{\\tprintf (\\\"Error : Out of memory.\\\\n\\\\n\\\") ;\\r\\n\\t\\treturn 1 ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tframes = BLOCK_SIZE / channels ;\\r\\n\\r\\n\\twhile ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)\\r\\n\\t{\\tfor (k = 0 ; k < readcount ; k++)\\r\\n\\t\\t{\\tfor (m = 0 ; m < channels ; m++)\\r\\n\\t\\t\\t\\tif (full_precision)\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" %.*e\\\", OP_DBL_Digs - 1, buf [k * channels + m]) ;\\r\\n\\t\\t\\t\\telse\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" % 12.10f\\\", buf [k * channels + m]) ;\\r\\n\\t\\t\\tfprintf (outfile, \\\"\\\\n\\\") ;\\r\\n\\t\\t\\t} ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfree (buf) ;\\r\\n\\r\\n\\treturn 0 ;\\r\\n} /* convert_to_text */\\r\\n\\r\\nint\\r\\nmain (int argc, char * argv [])\\r\\n{\\tchar \\t\\t*progname, *infilename, *outfilename ;\\r\\n\\tSNDFILE\\t\\t*infile = NULL ;\\r\\n\\tFILE\\t\\t*outfile = NULL ;\\r\\n\\tSF_INFO\\t\\tsfinfo ;\\r\\n\\tint\\t\\tfull_precision = 0 ;\\r\\n\\tint \\tret = 1 ;\\r\\n\\r\\n\\tprogname = strrchr (argv [0], '/') ;\\r\\n\\tprogname = progname ? progname + 1 : argv [0] ;\\r\\n\\r\\n\\tswitch (argc)\\r\\n\\t{\\tcase 4 :\\r\\n\\t\\t\\tif (!strcmp (\\\"--full-precision\\\", argv [3]))\\r\\n\\t\\t\\t{\\tprint_usage (progname) ;\\r\\n\\t\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t\\t\\t} ;\\r\\n\\t\\t\\tfull_precision = 1 ;\\r\\n\\t\\t\\targv++ ;\\r\\n\\t\\tcase 3 :\\r\\n\\t\\t\\tbreak ;\\r\\n\\t\\tdefault:\\r\\n\\t\\t\\tprint_usage (progname) ;\\r\\n\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tinfilename = argv [1] ;\\r\\n\\toutfilename = argv [2] ;\\r\\n\\r\\n\\tif (strcmp (infilename, outfilename) == 0)\\r\\n\\t{\\tprintf (\\\"Error : Input and output filenames are the same.\\\\n\\\\n\\\") ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (infilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Input filename (%s) looks like an option.\\\\n\\\\n\\\", infilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (outfilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Output filename (%s) looks like an option.\\\\n\\\\n\\\", outfilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tmemset (&sfinfo, 0, sizeof (sfinfo)) ;\\r\\n\\r\\n\\tif ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open input file %s.\\\\n\\\", infilename) ;\\r\\n\\t\\tputs (sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\t/* Open the output file. */\\r\\n\\tif ((outfile = fopen (outfilename, \\\"w\\\")) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open output file %s : %s\\\\n\\\", outfilename, sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfprintf (outfile, \\\"# Converted from file %s.\\\\n\\\", infilename) ;\\r\\n\\tfprintf (outfile, \\\"# Channels %d, Sample rate %d\\\\n\\\", sfinfo.channels, sfinfo.samplerate) ;\\r\\n\\r\\n\\tret = convert_to_text (infile, outfile, sfinfo.channels, full_precision) ;\\r\\n\\r\\ncleanup :\\r\\n\\r\\n\\tsf_close (infile) ;\\r\\n\\tif (outfile != NULL)\\r\\n\\t\\tfclose (outfile) ;\\r\\n\\r\\n\\treturn ret ;\\r\\n} /* main */\\r\\n\",\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}}\r\n\r\nI[22:37:07.136] <-- textDocument/didOpen\r\n"
'V[22:37:07.136] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[22:37:07.136] <-- textDocument/semanticTokens/full(2)\r\n'
"I[22:37:07.137] Loaded compilation database from C:/Users/USER/proj/sndfile-test/build/compile_commands.json\r\nV[22:37:07.137] Broadcasting compilation database from C:/Users/USER/proj/sndfile-test\r\nI[22:37:07.137] ASTWorker building file C:/Users/USER/proj/sndfile-test/main.c version 0 with command clangd fallback\r\n[C:/Users/USER/proj/sndfile-test]\r\nC:/msys64/clang64/bin/clang -resource-dir=C:/msys64/clang64/lib/clang/18 -- C:/Users/USER/proj/sndfile-test/main.c\r\n"
"V[22:37:07.139] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -fno-use-init-array -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=C:/Users/USER/proj/sndfile-test -fcoverage-compilation-dir=C:/Users/USER/proj/sndfile-test -resource-dir C:/msys64/clang64/lib/clang/18 -internal-isystem C:/msys64/clang64/lib/clang/18/include -internal-isystem C:/msys64/clang64/x86_64-w64-mingw32/include -internal-isystem C:/msys64/clang64/x86_64-w64-mingw32/usr/include -internal-isystem C:/msys64/clang64/include -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -exception-model=seh -no-round-trip-args -faddrsig -x c C:/Users/USER/proj/sndfile-test/main.c\r\nV[22:37:07.139] Building first preamble for C:/Users/USER/proj/sndfile-test/main.c version 0\r\n"
"I[22:37:07.165] Built preamble of size 626412 for file C:/Users/USER/proj/sndfile-test/main.c version 0 in 0.03 seconds\r\n"
"I[22:37:07.165] --> workspace/semanticTokens/refresh(0)\r\n"
'V[22:37:07.165] >>> {"id":0,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}\r\n\r\n'
'I[22:37:07.165] Indexing c17 standard library in the context of C:/Users/USER/proj/sndfile-test/main.c\r\nV[22:37:07.166] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}\r\n\r\nI[22:37:07.166] <-- $/cancelRequest\r\nV[22:37:07.166] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[22:37:07.166] <-- textDocument/semanticTokens/full(3)\r\n'
'V[22:37:07.166] <<< {"id":0,"jsonrpc":"2.0","result":null}\r\n\r\nI[22:37:07.166] <-- reply(0)\r\n'
"V[22:37:07.178] indexed preamble AST for C:/Users/USER/proj/sndfile-test/main.c version 0:\r\n  symbol slab: 1868 symbols, 531800 bytes\r\n  ref slab: 0 symbols, 0 refs, 128 bytes\r\n  relations slab: 0 relations, 24 bytes\r\n"
"E[22:37:07.182] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\r\n"
"V[22:37:07.183] indexed file AST for C:/Users/USER/proj/sndfile-test/main.c version 0:\r\n  symbol slab: 5 symbols, 5376 bytes\r\n  ref slab: 28 symbols, 61 refs, 4992 bytes\r\n  relations slab: 0 relations, 24 bytes\r\nV[22:37:07.183] Build dynamic index for main-file symbols with estimated memory usage of 16040 bytes\r\nI[22:37:07.183] --> textDocument/publishDiagnostics\r\n"
"V[22:37:07.183] >>> {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/publishDiagnostics\",\"params\":{\"diagnostics\":[{\"code\":\"pp_file_not_found\",\"message\":\"'header.h' file not found\",\"range\":{\"end\":{\"character\":19,\"line\":5},\"start\":{\"character\":9,\"line\":5}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unused-includes\",\"codeDescription\":{\"href\":\"https://clangd.llvm.org/guides/include-cleaner\"},\"message\":\"Included header ctype.h is not used directly (fix available)\",\"range\":{\"end\":{\"character\":18,\"line\":3},\"start\":{\"character\":0,\"line\":3}},\"relatedInformation\":[],\"severity\":2,\"source\":\"clangd\",\"tags\":[1]}],\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}\r\n\r\n"
'I[22:37:07.183] --> reply:textDocument/semanticTokens/full(2) 46 ms, error: Task was cancelled.\r\nV[22:37:07.183] >>> {"error":{"code":-32800,"message":"Request cancelled"},"id":2,"jsonrpc":"2.0"}\r\n\r\nV[22:37:07.183] ASTWorker running SemanticHighlights on version 0 of C:/Users/USER/proj/sndfile-test/main.c\r\nI[22:37:07.183] --> reply:textDocument/semanticTokens/full(3) 17 ms\r\nV[22:37:07.183] >>> {"id":3,"jsonrpc":"2.0","result":{"data":[8,8,10,19,131073,2,7,15,19,131072,1,9,11,19,131073,0,13,15,19,131072,2,0,20,24,0,1,0,36,24,0,1,0,7,24,0,1,0,36,24,0,1,0,8,24,0,4,0,11,3,65539,0,19,8,2,16387,1,2,6,3,131584,0,72,8,2,16384,1,1,4,3,131584,8,0,15,3,65539,0,17,7,8,66048,0,10,6,2,16387,0,8,4,8,66048,0,7,7,2,16387,0,13,8,2,16387,0,14,14,2,16387,1,9,3,1,16387,1,1,10,18,66048,0,11,6,1,16387,1,5,1,1,16387,0,3,1,1,16387,0,3,9,1,16387,2,1,3,1,16384,0,4,1,21,0,0,2,6,3,131584,0,8,10,19,131072,0,11,1,21,0,1,5,3,1,16384,0,4,2,21,0,0,3,4,19,131072,1,3,6,3,131584,4,1,6,1,16384,0,7,1,21,0,0,2,10,19,131072,0,11,1,21,0,0,2,8,2,16384,2,9,9,1,16384,0,10,1,21,0,0,8,14,3,131584,0,16,6,2,18432,0,8,3,1,18432,0,5,6,1,16384,0,9,1,21,0,1,8,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,9,1,16384,0,12,1,1,16384,0,1,2,21,0,1,9,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,11,1,1,16384,0,1,2,21,0,1,8,14,2,16384,1,5,7,3,131584,0,9,7,2,18432,0,18,11,19,131072,0,12,1,21,0,0,5,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,2,5,7,3,131584,0,9,7,2,18432,0,22,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,1,3,7,3,131584,0,9,7,2,18432,4,1,4,3,131584,0,6,3,1,18432,6,0,4,3,131075,0,10,4,2,16387,0,13,4,2,16387,1,10,8,1,16387,0,11,10,1,16387,0,13,11,1,16387,1,1,7,8,66048,0,10,6,1,16387,0,9,4,19,131072,1,1,4,8,66048,0,7,7,1,16387,0,10,4,19,131072,1,1,7,8,66048,0,9,6,1,16387,1,6,14,1,16387,1,6,3,1,16387,2,1,8,1,16384,0,9,1,21,0,0,2,7,3,131584,0,9,4,2,16384,1,1,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,4,1,21,0,0,2,4,2,16384,2,9,4,2,16384,2,7,1,21,0,0,1,6,3,131584,0,28,4,2,16384,1,5,11,3,65536,0,13,8,1,18432,1,9,7,23,16384,2,3,14,1,16384,0,15,1,21,0,1,3,4,2,16384,0,4,2,21,0,4,3,11,3,65536,0,13,8,1,18432,1,8,7,23,16384,3,1,10,1,16384,0,11,1,21,0,0,2,4,2,16384,1,1,11,1,16384,0,12,1,21,0,0,2,4,2,16384,2,5,6,3,131584,0,8,10,1,16384,0,12,11,1,16384,0,13,2,21,0,1,3,6,3,131584,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,10,1,16384,0,15,2,21,0,1,3,6,3,131584,0,65,10,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,11,1,16384,0,16,2,21,0,1,3,6,3,131584,0,66,11,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,1,6,3,131584,0,8,1,21,0,0,1,6,1,18432,0,19,6,1,16384,2,6,6,1,16384,0,7,1,21,0,0,2,7,3,131584,0,9,10,1,16384,0,12,8,11,66064,0,10,1,21,0,0,1,6,1,18432,0,9,2,21,0,0,3,4,19,131072,1,3,6,3,131584,0,45,10,1,16384,1,2,4,3,131584,0,6,11,3,131584,0,13,4,19,131072,1,7,7,23,16384,4,6,7,1,16384,0,8,1,21,0,0,2,5,3,131584,0,7,11,1,16384,0,19,2,21,0,0,3,4,19,131072,1,3,6,3,131584,0,50,11,1,16384,0,13,11,3,131584,0,13,4,19,131072,1,7,7,23,16384,3,1,7,3,131584,0,9,7,1,18432,0,40,10,1,16384,1,1,7,3,131584,0,9,7,1,18432,0,44,6,1,16384,0,7,8,6,33280,0,10,6,1,16384,0,7,10,6,33280,2,1,3,1,16384,0,4,1,21,0,0,2,15,3,65536,0,17,6,1,18432,0,8,7,1,18432,0,9,6,1,16384,0,7,8,6,33280,0,10,14,1,16384,2,0,7,23,16385,2,1,8,3,131584,0,10,6,1,18432,1,5,7,1,16384,0,8,2,21,0,0,3,4,19,131072,1,2,6,3,131584,0,8,7,1,18432,2,8,3,1,16384],"resultId":"1"}}\r\n\r\n'
"V[22:37:07.185] Build dynamic index for header symbols with estimated memory usage of 1832944 bytes\r\n"
"I[22:37:07.210] Indexed c17 standard library: 2653 symbols, 35 filtered\r\n"
"V[22:37:07.219] Build dynamic index for header symbols with estimated memory usage of 2300252 bytes\r\n"
HighCommander4 commented 3 months ago

These lines from the log:

I[22:37:07.137] ASTWorker building file C:/Users/USER/proj/sndfile-test/main.c version 0 with command clangd fallback [C:/Users/USER/proj/sndfile-test] C:/msys64/clang64/bin/clang -resource-dir=C:/msys64/clang64/lib/clang/18 -- C:/Users/USER/proj/sndfile-test/main.c\r\n"

suggest that clangd is not using the compile_commands.json file for some reason.

HighCommander4 commented 3 months ago

I suspect the reason may be related to the discrepancy between the format of the paths that the editor is sending to clangd (e.g. C:/Users/USER/proj/sndfile-test/main.c), and the format of the paths present in compile_commands.json (e.g. /c/Users/USER/proj/sndfile-test/main.c).

HighCommander4 commented 3 months ago

Can you try changing the paths in the "file" and "directory" fields of compile_commands.json to use C:/ instead of /c/, and see if that makes any difference?

ymich9963 commented 3 months ago

Doesn't line 12 in the logs signify it's loaded? Here's the new logs and new compile_commands.json file. Something broke...

[ERROR][2024-07-09 22:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    'V[22:49:50.277] <<< {"id":4,"jsonrpc":"2.0","method":"shutdown"}\r\n\r\nI[22:49:50.277] <-- shutdown(4)\r\nI[22:49:50.277] --> reply:shutdown(4) 0 ms\r\nV[22:49:50.277] >>> {"id":4,"jsonrpc":"2.0","result":null}\r\n\r\n'
[ERROR][2024-07-09 22:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    'V[22:49:50.278] <<< {"jsonrpc":"2.0","method":"exit"}\r\n\r\nI[22:49:50.278] <-- exit\r\n'
[ERROR][2024-07-09 22:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    "I[22:49:50.278] LSP finished, exiting with status 0\r\n"
[ERROR][2024-07-09 22:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    "I[22:49:50.813] clangd version 18.1.4\r\n"
[ERROR][2024-07-09 22:49:50] .../vim/lsp/rpc.lua:734    "rpc"   "C:\\Users\\USER\\AppData\\Local\\nvim-data\\mason\\bin\\clangd.CMD"    "stderr"    "I[22:49:50.813] Features: windows\r\nI[22:49:50.813] PID: 9564\r\nI[22:49:50.813] Working directory: C:/Users/USER/proj/sndfile-test\r\nI[22:49:50.813] argv[0]: C:/msys64/clang64/bin/clangd.exe\r\nI[22:49:50.813] argv[1]: --log=verbose\r\n"
"V[22:49:50.815] User config file is C:/Users/USER/AppData/Local/clangd/config.yaml\r\nI[22:49:50.816] Starting LSP over stdin/stdout\r\n"
'V[22:49:50.816] <<< {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"dynamicRegistration":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"snippetSupport":false},"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":false,"dynamicRegistration":false,"editsNearCursor":true},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":false,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":true,"requests":{"full":{"delta":true},"range":false},"serverCancelSupport":false,"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","decorator"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"linkSupport":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}},"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":false,"relativePatternSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":false,"hierarchicalWorkspaceSymbolSupport":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]}},"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Neovim","version":"0.9.5"},"initializationOptions":{},"processId":4200,"rootPath":null,"rootUri":null,"trace":"off","workspaceFolders":null}}\r\n\r\nI[22:49:50.816] <-- initialize(1)\r\n'
"I[22:49:50.817] --> reply:initialize(1) 1 ms\r\n"
'V[22:49:50.817] >>> {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":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"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","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","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"offsetEncoding":"utf-8","serverInfo":{"name":"clangd","version":"clangd version 18.1.4 windows x86_64-w64-windows-gnu"}}}\r\n\r\n'
'V[22:49:50.818] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}\r\n\r\nI[22:49:50.818] <-- initialized\r\n'
"V[22:49:50.818] <<< {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didOpen\",\"params\":{\"textDocument\":{\"languageId\":\"c\",\"text\":\"#include <stdio.h>\\r\\n#include <stdlib.h>\\r\\n#include <string.h>\\r\\n#include <ctype.h>\\r\\n#include <float.h>\\r\\n#include \\\"header.h\\\"\\r\\n#include <sndfile.h>\\r\\n\\r\\n#define\\tBLOCK_SIZE 4096\\r\\n\\r\\n#ifdef DBL_DECIMAL_DIG\\r\\n\\t#define OP_DBL_Digs (DBL_DECIMAL_DIG)\\r\\n#else\\r\\n\\t#ifdef DECIMAL_DIG\\r\\n\\t\\t#define OP_DBL_Digs (DECIMAL_DIG)\\r\\n\\t#else\\r\\n\\t\\t#define OP_DBL_Digs (DBL_DIG + 3)\\r\\n\\t#endif\\r\\n#endif\\r\\n\\r\\nstatic void\\r\\nprint_usage (char *progname)\\r\\n{\\tprintf (\\\"\\\\nUsage : %s [--full-precision] <input file> <output file>\\\\n\\\", progname) ;\\r\\n\\tputs (\\\"\\\\n\\\"\\r\\n\\t\\t\\\"    Where the output file will contain a line for each frame\\\\n\\\"\\r\\n\\t\\t\\\"    and a column for each channel.\\\\n\\\"\\r\\n\\t\\t) ;\\r\\n\\r\\n} /* print_usage */\\r\\n\\r\\nstatic int\\r\\nconvert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precision)\\r\\n{\\tfloat *buf ;\\r\\n\\tsf_count_t frames ;\\r\\n\\tint k, m, readcount ;\\r\\n\\r\\n\\tbuf = malloc (BLOCK_SIZE * sizeof (float)) ;\\r\\n\\tif (buf == NULL)\\r\\n\\t{\\tprintf (\\\"Error : Out of memory.\\\\n\\\\n\\\") ;\\r\\n\\t\\treturn 1 ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tframes = BLOCK_SIZE / channels ;\\r\\n\\r\\n\\twhile ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)\\r\\n\\t{\\tfor (k = 0 ; k < readcount ; k++)\\r\\n\\t\\t{\\tfor (m = 0 ; m < channels ; m++)\\r\\n\\t\\t\\t\\tif (full_precision)\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" %.*e\\\", OP_DBL_Digs - 1, buf [k * channels + m]) ;\\r\\n\\t\\t\\t\\telse\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" % 12.10f\\\", buf [k * channels + m]) ;\\r\\n\\t\\t\\tfprintf (outfile, \\\"\\\\n\\\") ;\\r\\n\\t\\t\\t} ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfree (buf) ;\\r\\n\\r\\n\\treturn 0 ;\\r\\n} /* convert_to_text */\\r\\n\\r\\nint\\r\\nmain (int argc, char * argv [])\\r\\n{\\tchar \\t\\t*progname, *infilename, *outfilename ;\\r\\n\\tSNDFILE\\t\\t*infile = NULL ;\\r\\n\\tFILE\\t\\t*outfile = NULL ;\\r\\n\\tSF_INFO\\t\\tsfinfo ;\\r\\n\\tint\\t\\tfull_precision = 0 ;\\r\\n\\tint \\tret = 1 ;\\r\\n\\r\\n\\tprogname = strrchr (argv [0], '/') ;\\r\\n\\tprogname = progname ? progname + 1 : argv [0] ;\\r\\n\\r\\n\\tswitch (argc)\\r\\n\\t{\\tcase 4 :\\r\\n\\t\\t\\tif (!strcmp (\\\"--full-precision\\\", argv [3]))\\r\\n\\t\\t\\t{\\tprint_usage (progname) ;\\r\\n\\t\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t\\t\\t} ;\\r\\n\\t\\t\\tfull_precision = 1 ;\\r\\n\\t\\t\\targv++ ;\\r\\n\\t\\tcase 3 :\\r\\n\\t\\t\\tbreak ;\\r\\n\\t\\tdefault:\\r\\n\\t\\t\\tprint_usage (progname) ;\\r\\n\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tinfilename = argv [1] ;\\r\\n\\toutfilename = argv [2] ;\\r\\n\\r\\n\\tif (strcmp (infilename, outfilename) == 0)\\r\\n\\t{\\tprintf (\\\"Error : Input and output filenames are the same.\\\\n\\\\n\\\") ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (infilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Input filename (%s) looks like an option.\\\\n\\\\n\\\", infilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (outfilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Output filename (%s) looks like an option.\\\\n\\\\n\\\", outfilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tmemset (&sfinfo, 0, sizeof (sfinfo)) ;\\r\\n\\r\\n\\tif ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open input file %s.\\\\n\\\", infilename) ;\\r\\n\\t\\tputs (sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\t/* Open the output file. */\\r\\n\\tif ((outfile = fopen (outfilename, \\\"w\\\")) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open output file %s : %s\\\\n\\\", outfilename, sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfprintf (outfile, \\\"# Converted from file %s.\\\\n\\\", infilename) ;\\r\\n\\tfprintf (outfile, \\\"# Channels %d, Sample rate %d\\\\n\\\", sfinfo.channels, sfinfo.samplerate) ;\\r\\n\\r\\n\\tret = convert_to_text (infile, outfile, sfinfo.channels, full_precision) ;\\r\\n\\r\\ncleanup :\\r\\n\\r\\n\\tsf_close (infile) ;\\r\\n\\tif (outfile != NULL)\\r\\n\\t\\tfclose (outfile) ;\\r\\n\\r\\n\\treturn ret ;\\r\\n} /* main */\\r\\n\",\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}}\r\n\r\nI[22:49:50.818] <-- textDocument/didOpen\r\n"
'V[22:49:50.818] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[22:49:50.818] <-- textDocument/semanticTokens/full(2)\r\n'
"I[22:49:50.819] Loaded compilation database from C:/Users/USER/proj/sndfile-test/build/compile_commands.json\r\n"
"I[22:49:50.819] ASTWorker building file C:/Users/USER/proj/sndfile-test/main.c version 0 with command \r\n[C:/Users/USER/proj/sndfile-test/build]\r\n/clang64/bin/clang.exe -IC:/Users/USER/proj/sndfile-test/inc -isystem /clang64/include -o CMakeFiles/test.dir/main.c.o -c -resource-dir=C:/msys64/clang64/lib/clang/18 -- C:/Users/USER/proj/sndfile-test/main.c\r\n"
"V[22:49:50.819] Broadcasting compilation database from C:/Users/USER/proj/sndfile-test\r\n"
"I[22:49:50.820] --> window/workDoneProgress/create(0)\r\n"
'V[22:49:50.820] >>> {"id":0,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"backgroundIndexProgress"}}\r\n\r\nI[22:49:50.820] Enqueueing 2 commands for indexing\r\n'
'V[22:49:50.820] <<< {"id":0,"jsonrpc":"2.0","result":null}\r\n\r\nI[22:49:50.820] <-- reply(0)\r\n'
'I[22:49:50.820] --> $/progress\r\nV[22:49:50.820] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"begin","percentage":0,"title":"indexing"}}}\r\n\r\nI[22:49:50.820] --> $/progress\r\nV[22:49:50.820] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/1","percentage":0}}}\r\n\r\n'
"V[22:49:50.822] BackgroundIndex: building version 1 after loading index from disk\r\n"
"V[22:49:50.822] BackgroundIndex: serving version 1 (47240 bytes)\r\n"
"I[22:49:50.823] --> $/progress\r\n"
'V[22:49:50.823] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/1","percentage":0}}}\r\n\r\nI[22:49:50.823] --> $/progress\r\nV[22:49:50.823] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}\r\n\r\n'
"V[22:49:50.844] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -fno-use-init-array -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=C:/Users/USER/proj/sndfile-test/build -fcoverage-compilation-dir=C:/Users/USER/proj/sndfile-test/build -resource-dir C:/msys64/clang64/lib/clang/18 -isystem /clang64/include -I C:/Users/USER/proj/sndfile-test/inc -internal-isystem C:/msys64/clang64/lib/clang/18/include -internal-isystem /clang64/x86_64-w64-mingw32/include -internal-isystem /clang64/x86_64-w64-mingw32/usr/include -internal-isystem /clang64/include -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -exception-model=seh -no-round-trip-args -faddrsig -x c C:/Users/USER/proj/sndfile-test/main.c\r\n"
"V[22:49:50.844] Building first preamble for C:/Users/USER/proj/sndfile-test/main.c version 0\r\n"
"I[22:49:50.853] Built preamble of size 221364 for file C:/Users/USER/proj/sndfile-test/main.c version 0 in 0.01 seconds\r\n"
'I[22:49:50.853] --> workspace/semanticTokens/refresh(1)\r\nV[22:49:50.853] >>> {"id":1,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}\r\n\r\n'
'V[22:49:50.854] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}\r\n\r\nI[22:49:50.854] <-- $/cancelRequest\r\n'
'V[22:49:50.854] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[22:49:50.854] <-- textDocument/semanticTokens/full(3)\r\nV[22:49:50.854] <<< {"id":1,"jsonrpc":"2.0","result":null}\r\n\r\nI[22:49:50.854] <-- reply(1)\r\n'
"V[22:49:50.854] indexed preamble AST for C:/Users/USER/proj/sndfile-test/main.c version 0:\r\n  symbol slab: 43 symbols, 14192 bytes\r\n  ref slab: 0 symbols, 0 refs, 128 bytes\r\n  relations slab: 0 relations, 24 bytes\r\n"
"V[22:49:50.854] Build dynamic index for header symbols with estimated memory usage of 62500 bytes\r\n"
'V[22:49:50.898] Trying to fix unresolved name "puts" in scopes: []\r\nV[22:49:50.898] Dex query tree: false\r\nV[22:49:50.899] Dex query tree: false\r\n'
'V[22:49:50.899] Trying to fix unresolved name "SNDFILE" in scopes: []\r\nV[22:49:50.899] Dex query tree: false\r\nV[22:49:50.899] Dex query tree: false\r\n'
'V[22:49:50.899] Trying to fix unresolved name "FILE" in scopes: []\r\nV[22:49:50.899] Dex query tree: false\r\nV[22:49:50.899] Dex query tree: false\r\n'
'V[22:49:50.899] Trying to fix unresolved name "sf_count_t" in scopes: []\r\nV[22:49:50.899] Dex query tree: false\r\nV[22:49:50.899] Dex query tree: false\r\n'
'V[22:49:50.899] Trying to fix unresolved name "NULL" in scopes: []\r\nV[22:49:50.899] Dex query tree: false\r\nV[22:49:50.899] Dex query tree: false\r\n'
'V[22:49:50.899] Trying to fix unresolved name "frames" in scopes: []\r\n'
'V[22:49:50.899] Trying to fix unresolved name "sf_readf_float" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "frames" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "fprintf" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "SNDFILE" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "infile" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "NULL" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "FILE" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "outfile" in scopes: []\r\n'
'V[22:49:50.900] Trying to fix unresolved name "NULL" in scopes: []\r\n'
'V[22:49:50.901] Trying to fix unresolved name "SF_INFO" in scopes: []\r\n'
"E[22:49:50.901] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\r\nE[22:49:50.901] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\r\nE[22:49:50.901] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\r\nE[22:49:50.901] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\r\nE[22:49:50.901] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\r\n"
"V[22:49:50.902] indexed file AST for C:/Users/USER/proj/sndfile-test/main.c version 0:\r\n  symbol slab: 5 symbols, 5376 bytes\r\n  ref slab: 6 symbols, 15 refs, 4416 bytes\r\n  relations slab: 0 relations, 24 bytes\r\nV[22:49:50.902] Build dynamic index for main-file symbols with estimated memory usage of 13992 bytes\r\n"
"I[22:49:50.902] --> textDocument/publishDiagnostics\r\n"
"V[22:49:50.902] >>> {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/publishDiagnostics\",\"params\":{\"diagnostics\":[{\"code\":\"pp_file_not_found\",\"message\":\"'stdio.h' file not found\",\"range\":{\"end\":{\"character\":18,\"line\":0},\"start\":{\"character\":9,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":8,\"line\":22},\"start\":{\"character\":2,\"line\":22}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":8,\"line\":22},\"start\":{\"character\":2,\"line\":22}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdio.h> or explicitly provide a declaration for 'printf'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'puts'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":5,\"line\":23},\"start\":{\"character\":1,\"line\":23}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unknown_typename\",\"message\":\"Unknown type name 'SNDFILE'\",\"range\":{\"end\":{\"character\":24,\"line\":31},\"start\":{\"character\":17,\"line\":31}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"unknown_typename\",\"message\":\"Unknown type name 'FILE'\",\"range\":{\"end\":{\"character\":39,\"line\":31},\"start\":{\"character\":35,\"line\":31}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'sf_count_t'\",\"range\":{\"end\":{\"character\":11,\"line\":33},\"start\":{\"character\":1,\"line\":33}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'malloc' with type 'void *(unsigned long long)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":13,\"line\":36},\"start\":{\"character\":7,\"line\":36}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":13,\"line\":36},\"start\":{\"character\":7,\"line\":36}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdlib.h> or explicitly provide a declaration for 'malloc'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":16,\"line\":37},\"start\":{\"character\":12,\"line\":37}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'frames'\",\"range\":{\"end\":{\"character\":7,\"line\":42},\"start\":{\"character\":1,\"line\":42}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'sf_readf_float'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":41,\"line\":44},\"start\":{\"character\":27,\"line\":44}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'frames'\",\"range\":{\"end\":{\"character\":62,\"line\":44},\"start\":{\"character\":56,\"line\":44}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared function 'fprintf'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":12,\"line\":48},\"start\":{\"character\":5,\"line\":48}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"-Wbuiltin-requires-header\",\"message\":\"Declaration of built-in function 'fprintf' requires inclusion of the header <stdio.h>\",\"range\":{\"end\":{\"character\":12,\"line\":48},\"start\":{\"character\":5,\"line\":48}},\"relatedInformation\":[],\"severity\":2,\"source\":\"clang\"},{\"code\":\"-Wimplicit-function-declaration\",\"message\":\"Call to undeclared library function 'free' with type 'void (void *)'; ISO C99 and later do not support implicit function declarations\",\"range\":{\"end\":{\"character\":5,\"line\":55},\"start\":{\"character\":1,\"line\":55}},\"relatedInformation\":[{\"location\":{\"range\":{\"end\":{\"character\":5,\"line\":55},\"start\":{\"character\":1,\"line\":55}},\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\"},\"message\":\"Include the header <stdlib.h> or explicitly provide a declaration for 'free'\"}],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'SNDFILE'\",\"range\":{\"end\":{\"character\":8,\"line\":63},\"start\":{\"character\":1,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'infile'\",\"range\":{\"end\":{\"character\":17,\"line\":63},\"start\":{\"character\":11,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":24,\"line\":63},\"start\":{\"character\":20,\"line\":63}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'FILE'\",\"range\":{\"end\":{\"character\":5,\"line\":64},\"start\":{\"character\":1,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'outfile'\",\"range\":{\"end\":{\"character\":15,\"line\":64},\"start\":{\"character\":8,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'NULL'\",\"range\":{\"end\":{\"character\":22,\"line\":64},\"start\":{\"character\":18,\"line\":64}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'SF_INFO'\",\"range\":{\"end\":{\"character\":8,\"line\":65},\"start\":{\"character\":1,\"line\":65}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"fatal_too_many_errors\",\"message\":\"Too many errors emitted, stopping now\",\"range\":{\"end\":{\"character\":0,\"line\":0},\"start\":{\"character\":0,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"}],\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}\r\n\r\nI[22:49:50.903] --> reply:textDocument/semanticTokens/full(2) 84 ms, error: Task was cancelled.\r\nV[22:49:50.903] >>> {\"error\":{\"code\":-32800,\"message\":\"Request cancelled\"},\"id\":2,\"jsonrpc\":\"2.0\"}\r\n\r\nV[22:49:50.903] ASTWorker running SemanticHighlights on version 0 of C:/Users/USER/proj/sndfile-test/main.c\r\nI[22:49:50.903] --> reply:textDocument/semanticTokens/full(3) 49 ms\r\nV[22:49:50.903] >>> {\"id\":3,\"jsonrpc\":\"2.0\",\"result\":{\"data\":[8,8,10,19,131073,2,7,15,19,131072,1,9,11,19,131073,0,13,15,19,131072,2,0,20,24,0,1,0,36,24,0,1,0,7,24,0,1,0,36,24,0,1,0,8,24,0,4,0,11,3,65539,0,19,8,2,16387,1,2,6,3,131072,0,72,8,2,16384,1,1,4,3,131072,8,0,15,3,65539,0,27,6,2,16387,0,15,7,2,16387,0,13,8,2,16387,0,14,14,2,16387,1,9,3,1,16387,2,5,1,1,16387,0,3,1,1,16387,0,3,9,1,16387,2,1,3,1,16384,0,4,1,21,0,0,2,6,3,131072,0,8,10,19,131072,0,11,1,21,0,1,5,3,1,16384,0,4,2,21,8192,1,3,6,3,131072,4,10,10,19,131072,3,8,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,9,1,16384,0,12,1,1,16384,0,1,2,21,0,1,9,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,11,1,1,16384,0,1,2,21,0,1,8,14,2,16384,1,5,7,3,131072,0,27,11,19,131072,0,12,1,21,0,0,5,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,2,5,7,3,131072,0,31,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,1,3,7,3,131072,4,1,4,3,131072,0,6,3,1,18432,6,0,4,3,131075,0,10,4,2,16387,0,13,4,2,16387,1,10,8,1,16387,0,11,10,1,16387,0,13,11,1,16387,4,6,14,1,16387,1,6,3,1,16387,2,1,8,1,16384,0,9,1,21,0,0,2,7,3,131072,0,9,4,2,16384,1,1,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,4,1,21,0,0,2,4,2,16384,2,9,4,2,16384,2,7,1,21,0,0,1,6,3,131072,0,28,4,2,16384,1,5,11,3,65536,0,13,8,1,18432,1,9,7,23,16384,2,3,14,1,16384,0,15,1,21,0,1,3,4,2,16384,0,4,2,21,0,4,3,11,3,65536,0,13,8,1,18432,1,8,7,23,16384,3,1,10,1,16384,0,11,1,21,0,0,2,4,2,16384,1,1,11,1,16384,0,12,1,21,0,0,2,4,2,16384,2,5,6,3,131072,0,8,10,1,16384,0,12,11,1,16384,0,13,2,21,0,1,3,6,3,131072,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,10,1,16384,0,15,2,21,0,1,3,6,3,131072,0,65,10,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,11,1,16384,0,16,2,21,0,1,3,6,3,131072,0,66,11,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,6,3,6,3,131072,0,45,10,1,16384,2,7,7,23,16384,6,7,7,23,16384,8,0,7,23,16385,6,8,3,1,16384],\"resultId\":\"1\"}}\r\n\r\n"
[
{
  "directory": "C:/Users/USER/proj/sndfile-test/build",
  "command": "/clang64/bin/clang.exe  -IC:/Users/USER/proj/sndfile-test/inc -isystem /clang64/include  -o CMakeFiles/test.dir/main.c.o -c C:/Users/USER/proj/sndfile-test/main.c",
  "file": "C:/Users/USER/proj/sndfile-test/main.c",
  "output": "CMakeFiles/test.dir/main.c.o"
},
{
  "directory": "C:/Users/USER/proj/sndfile-test/build/src",
  "command": "/clang64/bin/clang.exe  -IC:/Users/USER/proj/sndfile-test/src/../inc  -o CMakeFiles/src.dir/other1.c.o -c C:/Users/USER/proj/sndfile-test/src/other1.c",
  "file": "C:/Users/USER/proj/sndfile-test/src/other1.c",
  "output": "src/CMakeFiles/src.dir/other1.c.o"
}
]
ymich9963 commented 3 months ago

Even just changing the two fields you mentioned breaks it

HighCommander4 commented 3 months ago

Doesn't line 12 in the logs signify it's loaded?

Yeah, it looks like it's loaded, but (before the changes) clangd didn't consider its entries to be a match for the file being edited, due to the paths using different syntax.

Here's the new logs and new compile_commands.json file. Something broke...

Well, the error about header.h is gone :)

But the errors about the standard library includes are back :(

I'm kind of guessing at the cause here, but can you also try replacing /clang64/bin/clang.exe in "command" with C:/msys64/clang64/bin/clang?

ymich9963 commented 3 months ago

It seems to be working?!?! Please check the logs and the compile commands below,

'V[00:10:02.398] <<< {"id":4,"jsonrpc":"2.0","method":"shutdown"}\r\n\r\nI[00:10:02.398] <-- shutdown(4)\r\nI[00:10:02.398] --> reply:shutdown(4) 0 ms\r\nV[00:10:02.398] >>> {"id":4,"jsonrpc":"2.0","result":null}\r\n\r\n'
'V[00:10:02.398] <<< {"jsonrpc":"2.0","method":"exit"}\r\n\r\nI[00:10:02.398] <-- exit\r\nI[00:10:02.398] LSP finished, exiting with status 0\r\n'
"I[00:10:02.930] clangd version 18.1.4\r\nI[00:10:02.931] Features: windows\r\nI[00:10:02.931] PID: 17688\r\n"
"I[00:10:02.931] Working directory: C:/Users/USER/proj/sndfile-test\r\nI[00:10:02.931] argv[0]: C:/msys64/clang64/bin/clangd.exe\r\nI[00:10:02.931] argv[1]: --log=verbose\r\n"
"V[00:10:02.933] User config file is C:/Users/USER/AppData/Local/clangd/config.yaml\r\nI[00:10:02.933] Starting LSP over stdin/stdout\r\n"
'V[00:10:02.933] <<< {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"dynamicRegistration":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"snippetSupport":false},"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":false,"dynamicRegistration":false,"editsNearCursor":true},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":false,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":true,"requests":{"full":{"delta":true},"range":false},"serverCancelSupport":false,"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","decorator"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"linkSupport":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}},"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":false,"relativePatternSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":false,"hierarchicalWorkspaceSymbolSupport":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]}},"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Neovim","version":"0.9.5"},"initializationOptions":{},"processId":18108,"rootPath":null,"rootUri":null,"trace":"off","workspaceFolders":null}}\r\n\r\nI[00:10:02.933] <-- initialize(1)\r\n'
"I[00:10:02.935] --> reply:initialize(1) 1 ms\r\n"
'V[00:10:02.935] >>> {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":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"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","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","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"offsetEncoding":"utf-8","serverInfo":{"name":"clangd","version":"clangd version 18.1.4 windows x86_64-w64-windows-gnu"}}}\r\n\r\n'
'V[00:10:02.935] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}\r\n\r\nI[00:10:02.935] <-- initialized\r\n'
"V[00:10:02.935] <<< {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didOpen\",\"params\":{\"textDocument\":{\"languageId\":\"c\",\"text\":\"#include <stdio.h>\\r\\n#include <stdlib.h>\\r\\n#include <string.h>\\r\\n#include <ctype.h>\\r\\n#include <float.h>\\r\\n#include \\\"header.h\\\"\\r\\n#include <sndfile.h>\\r\\n\\r\\n#define\\tBLOCK_SIZE 4096\\r\\n\\r\\n#ifdef DBL_DECIMAL_DIG\\r\\n\\t#define OP_DBL_Digs (DBL_DECIMAL_DIG)\\r\\n#else\\r\\n\\t#ifdef DECIMAL_DIG\\r\\n\\t\\t#define OP_DBL_Digs (DECIMAL_DIG)\\r\\n\\t#else\\r\\n\\t\\t#define OP_DBL_Digs (DBL_DIG + 3)\\r\\n\\t#endif\\r\\n#endif\\r\\n\\r\\nstatic void\\r\\nprint_usage (char *progname)\\r\\n{\\tprintf (\\\"\\\\nUsage : %s [--full-precision] <input file> <output file>\\\\n\\\", progname) ;\\r\\n\\tputs (\\\"\\\\n\\\"\\r\\n\\t\\t\\\"    Where the output file will contain a line for each frame\\\\n\\\"\\r\\n\\t\\t\\\"    and a column for each channel.\\\\n\\\"\\r\\n\\t\\t) ;\\r\\n\\r\\n} /* print_usage */\\r\\n\\r\\nstatic int\\r\\nconvert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precision)\\r\\n{\\tfloat *buf ;\\r\\n\\tsf_count_t frames ;\\r\\n\\tint k, m, readcount ;\\r\\n\\r\\n\\tbuf = malloc (BLOCK_SIZE * sizeof (float)) ;\\r\\n\\tif (buf == NULL)\\r\\n\\t{\\tprintf (\\\"Error : Out of memory.\\\\n\\\\n\\\") ;\\r\\n\\t\\treturn 1 ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tframes = BLOCK_SIZE / channels ;\\r\\n\\r\\n\\twhile ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)\\r\\n\\t{\\tfor (k = 0 ; k < readcount ; k++)\\r\\n\\t\\t{\\tfor (m = 0 ; m < channels ; m++)\\r\\n\\t\\t\\t\\tif (full_precision)\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" %.*e\\\", OP_DBL_Digs - 1, buf [k * channels + m]) ;\\r\\n\\t\\t\\t\\telse\\r\\n\\t\\t\\t\\t\\tfprintf (outfile, \\\" % 12.10f\\\", buf [k * channels + m]) ;\\r\\n\\t\\t\\tfprintf (outfile, \\\"\\\\n\\\") ;\\r\\n\\t\\t\\t} ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfree (buf) ;\\r\\n\\r\\n\\treturn 0 ;\\r\\n} /* convert_to_text */\\r\\n\\r\\nint\\r\\nmain (int argc, char * argv [])\\r\\n{\\tchar \\t\\t*progname, *infilename, *outfilename ;\\r\\n\\tSNDFILE\\t\\t*infile = NULL ;\\r\\n\\tFILE\\t\\t*outfile = NULL ;\\r\\n\\tSF_INFO\\t\\tsfinfo ;\\r\\n\\tint\\t\\tfull_precision = 0 ;\\r\\n\\tint \\tret = 1 ;\\r\\n\\r\\n\\tprogname = strrchr (argv [0], '/') ;\\r\\n\\tprogname = progname ? progname + 1 : argv [0] ;\\r\\n\\r\\n\\tswitch (argc)\\r\\n\\t{\\tcase 4 :\\r\\n\\t\\t\\tif (!strcmp (\\\"--full-precision\\\", argv [3]))\\r\\n\\t\\t\\t{\\tprint_usage (progname) ;\\r\\n\\t\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t\\t\\t} ;\\r\\n\\t\\t\\tfull_precision = 1 ;\\r\\n\\t\\t\\targv++ ;\\r\\n\\t\\tcase 3 :\\r\\n\\t\\t\\tbreak ;\\r\\n\\t\\tdefault:\\r\\n\\t\\t\\tprint_usage (progname) ;\\r\\n\\t\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tinfilename = argv [1] ;\\r\\n\\toutfilename = argv [2] ;\\r\\n\\r\\n\\tif (strcmp (infilename, outfilename) == 0)\\r\\n\\t{\\tprintf (\\\"Error : Input and output filenames are the same.\\\\n\\\\n\\\") ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (infilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Input filename (%s) looks like an option.\\\\n\\\\n\\\", infilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tif (outfilename [0] == '-')\\r\\n\\t{\\tprintf (\\\"Error : Output filename (%s) looks like an option.\\\\n\\\\n\\\", outfilename) ;\\r\\n\\t\\tprint_usage (progname) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tmemset (&sfinfo, 0, sizeof (sfinfo)) ;\\r\\n\\r\\n\\tif ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open input file %s.\\\\n\\\", infilename) ;\\r\\n\\t\\tputs (sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\t/* Open the output file. */\\r\\n\\tif ((outfile = fopen (outfilename, \\\"w\\\")) == NULL)\\r\\n\\t{\\tprintf (\\\"Not able to open output file %s : %s\\\\n\\\", outfilename, sf_strerror (NULL)) ;\\r\\n\\t\\tgoto cleanup ;\\r\\n\\t\\t} ;\\r\\n\\r\\n\\tfprintf (outfile, \\\"# Converted from file %s.\\\\n\\\", infilename) ;\\r\\n\\tfprintf (outfile, \\\"# Channels %d, Sample rate %d\\\\n\\\", sfinfo.channels, sfinfo.samplerate) ;\\r\\n\\r\\n\\tret = convert_to_text (infile, outfile, sfinfo.channels, full_precision) ;\\r\\n\\r\\ncleanup :\\r\\n\\r\\n\\tsf_close (infile) ;\\r\\n\\tif (outfile != NULL)\\r\\n\\t\\tfclose (outfile) ;\\r\\n\\r\\n\\treturn ret ;\\r\\n} /* main */\\r\\n\",\"uri\":\"file:///C:/Users/USER/proj/sndfile-test/main.c\",\"version\":0}}}\r\n\r\nI[00:10:02.935] <-- textDocument/didOpen\r\n"
'V[00:10:02.935] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\n'
"I[00:10:02.935] <-- textDocument/semanticTokens/full(2)\r\n"
"I[00:10:02.936] Loaded compilation database from C:/Users/USER/proj/sndfile-test/build/compile_commands.json\r\nV[00:10:02.936] Broadcasting compilation database from C:/Users/USER/proj/sndfile-test\r\n"
"I[00:10:02.936] ASTWorker building file C:/Users/USER/proj/sndfile-test/main.c version 0 with command \r\n[C:/Users/USER/proj/sndfile-test/build]\r\nC:/msys64/clang64/bin/clang.exe -IC:/Users/USER/proj/sndfile-test/inc -isystem /clang64/include -o CMakeFiles/test.dir/main.c.o -c -resource-dir=C:/msys64/clang64/lib/clang/18 -- C:/Users/USER/proj/sndfile-test/main.c\r\n"
'I[00:10:02.937] --> window/workDoneProgress/create(0)\r\nV[00:10:02.937] >>> {"id":0,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"backgroundIndexProgress"}}\r\n\r\n'
"I[00:10:02.937] Enqueueing 2 commands for indexing\r\n"
'V[00:10:02.937] <<< {"id":0,"jsonrpc":"2.0","result":null}\r\n\r\n'
"I[00:10:02.937] <-- reply(0)\r\nI[00:10:02.937] --> $/progress\r\n"
'V[00:10:02.937] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"begin","percentage":0,"title":"indexing"}}}\r\n\r\nI[00:10:02.937] --> $/progress\r\n'
'V[00:10:02.937] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/1","percentage":0}}}\r\n\r\n'
"V[00:10:02.937] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -fno-use-init-array -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=C:/Users/USER/proj/sndfile-test/build -fcoverage-compilation-dir=C:/Users/USER/proj/sndfile-test/build -resource-dir C:/msys64/clang64/lib/clang/18 -isystem /clang64/include -I C:/Users/USER/proj/sndfile-test/inc -internal-isystem C:/msys64/clang64/lib/clang/18/include -internal-isystem C:/msys64/clang64/x86_64-w64-mingw32/include -internal-isystem C:/msys64/clang64/x86_64-w64-mingw32/usr/include -internal-isystem C:/msys64/clang64/include -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -exception-model=seh -no-round-trip-args -faddrsig -x c C:/Users/USER/proj/sndfile-test/main.c\r\nV[00:10:02.937] Building first preamble for C:/Users/USER/proj/sndfile-test/main.c version 0\r\n"
"V[00:10:02.945] BackgroundIndex: building version 1 after loading index from disk\r\n"
"V[00:10:02.949] BackgroundIndex: serving version 1 (1939052 bytes)\r\n"
"I[00:10:02.952] --> $/progress\r\n"
'V[00:10:02.952] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/1","percentage":0}}}\r\n\r\nI[00:10:02.952] --> $/progress\r\nV[00:10:02.952] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}\r\n\r\n'
"I[00:10:02.964] Built preamble of size 626792 for file C:/Users/USER/proj/sndfile-test/main.c version 0 in 0.03 seconds\r\n"
"I[00:10:02.964] --> workspace/semanticTokens/refresh(1)\r\n"
'V[00:10:02.964] >>> {"id":1,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}\r\n\r\n'
'V[00:10:02.965] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}\r\n\r\nI[00:10:02.965] <-- $/cancelRequest\r\nV[00:10:02.965] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c"}}}\r\n\r\nI[00:10:02.965] <-- textDocument/semanticTokens/full(3)\r\n'
'V[00:10:02.965] <<< {"id":1,"jsonrpc":"2.0","result":null}\r\n\r\nI[00:10:02.965] <-- reply(1)\r\n'
"I[00:10:02.965] Indexing c17 standard library in the context of C:/Users/USER/proj/sndfile-test/main.c\r\n"
"V[00:10:02.977] indexed preamble AST for C:/Users/USER/proj/sndfile-test/main.c version 0:\r\n  symbol slab: 1869 symbols, 536128 bytes\r\n  ref slab: 0 symbols, 0 refs, 128 bytes\r\n  relations slab: 0 relations, 24 bytes\r\n"
"V[00:10:02.979] indexed file AST for C:/Users/USER/proj/sndfile-test/main.c version 0:\r\n  symbol slab: 5 symbols, 5376 bytes\r\n  ref slab: 28 symbols, 61 refs, 4992 bytes\r\n  relations slab: 0 relations, 24 bytes\r\n"
"V[00:10:02.980] Build dynamic index for main-file symbols with estimated memory usage of 16040 bytes\r\n"
"I[00:10:02.980] --> textDocument/publishDiagnostics\r\n"
'V[00:10:02.980] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"unused-includes","codeDescription":{"href":"https://clangd.llvm.org/guides/include-cleaner"},"message":"Included header ctype.h is not used directly (fix available)","range":{"end":{"character":18,"line":3},"start":{"character":0,"line":3}},"relatedInformation":[],"severity":2,"source":"clangd","tags":[1]}],"uri":"file:///C:/Users/USER/proj/sndfile-test/main.c","version":0}}\r\n\r\n'
'I[00:10:02.980] --> reply:textDocument/semanticTokens/full(2) 44 ms, error: Task was cancelled.\r\nV[00:10:02.980] >>> {"error":{"code":-32800,"message":"Request cancelled"},"id":2,"jsonrpc":"2.0"}\r\n\r\nV[00:10:02.980] ASTWorker running SemanticHighlights on version 0 of C:/Users/USER/proj/sndfile-test/main.c\r\nI[00:10:02.980] --> reply:textDocument/semanticTokens/full(3) 15 ms\r\nV[00:10:02.980] >>> {"id":3,"jsonrpc":"2.0","result":{"data":[8,8,10,19,131073,2,7,15,19,131072,1,9,11,19,131073,0,13,15,19,131072,2,0,20,24,0,1,0,36,24,0,1,0,7,24,0,1,0,36,24,0,1,0,8,24,0,4,0,11,3,65539,0,19,8,2,16387,1,2,6,3,131584,0,72,8,2,16384,1,1,4,3,131584,8,0,15,3,65539,0,17,7,8,66048,0,10,6,2,16387,0,8,4,8,66048,0,7,7,2,16387,0,13,8,2,16387,0,14,14,2,16387,1,9,3,1,16387,1,1,10,18,66048,0,11,6,1,16387,1,5,1,1,16387,0,3,1,1,16387,0,3,9,1,16387,2,1,3,1,16384,0,4,1,21,0,0,2,6,3,131584,0,8,10,19,131072,0,11,1,21,0,1,5,3,1,16384,0,4,2,21,0,0,3,4,19,131072,1,3,6,3,131584,4,1,6,1,16384,0,7,1,21,0,0,2,10,19,131072,0,11,1,21,0,0,2,8,2,16384,2,9,9,1,16384,0,10,1,21,0,0,8,14,3,131584,0,16,6,2,18432,0,8,3,1,18432,0,5,6,1,16384,0,9,1,21,0,1,8,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,9,1,16384,0,12,1,1,16384,0,1,2,21,0,1,9,1,1,16384,0,2,1,21,0,0,6,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,11,1,1,16384,0,1,2,21,0,1,8,14,2,16384,1,5,7,3,131584,0,9,7,2,18432,0,18,11,19,131072,0,12,1,21,0,0,5,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,2,5,7,3,131584,0,9,7,2,18432,0,22,3,1,16384,0,5,1,1,16384,0,2,1,21,0,0,2,8,2,16384,0,9,1,21,0,0,2,1,1,16384,1,3,7,3,131584,0,9,7,2,18432,4,1,4,3,131584,0,6,3,1,18432,6,0,4,3,131075,0,10,4,2,16387,0,13,4,2,16387,1,10,8,1,16387,0,11,10,1,16387,0,13,11,1,16387,1,1,7,8,66048,0,10,6,1,16387,0,9,4,19,131072,1,1,4,8,66048,0,7,7,1,16387,0,10,4,19,131072,1,1,7,8,66048,0,9,6,1,16387,1,6,14,1,16387,1,6,3,1,16387,2,1,8,1,16384,0,9,1,21,0,0,2,7,3,131584,0,9,4,2,16384,1,1,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,2,8,1,16384,0,9,1,21,0,0,4,1,21,0,0,2,4,2,16384,2,9,4,2,16384,2,7,1,21,0,0,1,6,3,131584,0,28,4,2,16384,1,5,11,3,65536,0,13,8,1,18432,1,9,7,23,16384,2,3,14,1,16384,0,15,1,21,0,1,3,4,2,16384,0,4,2,21,0,4,3,11,3,65536,0,13,8,1,18432,1,8,7,23,16384,3,1,10,1,16384,0,11,1,21,0,0,2,4,2,16384,1,1,11,1,16384,0,12,1,21,0,0,2,4,2,16384,2,5,6,3,131584,0,8,10,1,16384,0,12,11,1,16384,0,13,2,21,0,1,3,6,3,131584,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,10,1,16384,0,15,2,21,0,1,3,6,3,131584,0,65,10,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,5,11,1,16384,0,16,2,21,0,1,3,6,3,131584,0,66,11,1,16384,1,2,11,3,65536,0,13,8,1,18432,1,7,7,23,16384,3,1,6,3,131584,0,8,1,21,0,0,1,6,1,18432,0,19,6,1,16384,2,6,6,1,16384,0,7,1,21,0,0,2,7,3,131584,0,9,10,1,16384,0,12,8,11,66064,0,10,1,21,0,0,1,6,1,18432,0,9,2,21,0,0,3,4,19,131072,1,3,6,3,131584,0,45,10,1,16384,1,2,4,3,131584,0,6,11,3,131584,0,13,4,19,131072,1,7,7,23,16384,4,6,7,1,16384,0,8,1,21,0,0,2,5,3,131584,0,7,11,1,16384,0,19,2,21,0,0,3,4,19,131072,1,3,6,3,131584,0,50,11,1,16384,0,13,11,3,131584,0,13,4,19,131072,1,7,7,23,16384,3,1,7,3,131584,0,9,7,1,18432,0,40,10,1,16384,1,1,7,3,131584,0,9,7,1,18432,0,44,6,1,16384,0,7,8,6,33280,0,10,6,1,16384,0,7,10,6,33280,2,1,3,1,16384,0,4,1,21,0,0,2,15,3,65536,0,17,6,1,18432,0,8,7,1,18432,0,9,6,1,16384,0,7,8,6,33280,0,10,14,1,16384,2,0,7,23,16385,2,1,8,3,131584,0,10,6,1,18432,1,5,7,1,16384,0,8,2,21,0,0,3,4,19,131072,1,2,6,3,131584,0,8,7,1,18432,2,8,3,1,16384],"resultId":"1"}}\r\n\r\n'
"V[00:10:02.984] Build dynamic index for header symbols with estimated memory usage of 1837468 bytes\r\n"
"I[00:10:03.008] Indexed c17 standard library: 2653 symbols, 35 filtered\r\n"
"V[00:10:03.017] Build dynamic index for header symbols with estimated memory usage of 2305224 bytes\r\n"
[
{
  "directory": "C:/Users/USER/proj/sndfile-test/build",
  "command": "C:/msys64/clang64/bin/clang.exe  -IC:/Users/USER/proj/sndfile-test/inc -isystem /clang64/include  -o CMakeFiles/test.dir/main.c.o -c C:/Users/USER/proj/sndfile-test/main.c",
  "file": "C:/Users/USER/proj/sndfile-test/main.c",
  "output": "CMakeFiles/test.dir/main.c.o"
},
{
  "directory": "C:/Users/USER/proj/sndfile-test/build/src",
  "command": "C:/msys64/clang64/bin/clang.exe  -IC:/Users/USER/proj/sndfile-test/src/../inc  -o CMakeFiles/src.dir/other1.c.o -c C:/Users/USER/proj/sndfile-test/src/other1.c",
  "file": "C:/Users/USER/proj/sndfile-test/src/other1.c",
  "output": "src/CMakeFiles/src.dir/other1.c.o"
}
]

If it is working, do you know if there's a way to output the correct paths without manually doing anything? I'm not sure how this makes sense because I'm using the MSYS2 clang and clang tools, so shouldn't it know how to use the paths?

HighCommander4 commented 3 months ago

It seems to be working?!?!

Great :)

do you know if there's a way to output the correct paths without manually doing anything? I'm not sure how this makes sense because I'm using the MSYS2 clang and clang tools, so shouldn't it know how to use the paths?

The only idea that comes to mind currently is maybe to use neovim from MSYS as well: https://packages.msys2.org/base/mingw-w64-neovim

ymich9963 commented 3 months ago

Damn that's annoying. Any chance I could maybe use the Windows version of CMake to generate the paths? Or maybe that wouldn't work with MSYS2...

HighCommander4 commented 3 months ago

I'm afraid I don't have a better answer than "try it and see" :/ I'm not a Windows user myself (nor a CMake user).

ymich9963 commented 3 months ago

Alright! You've been more than helpful. I can't thank you enough!! I hope this issue also helps other people in a similar situation. Have a good day!

ymich9963 commented 3 months ago

Just to 100% finish this issue. To fix the includes you can put in the full relative path to the file. In my case for example I used #include "inc/header.h" in main.c and the error went away without editing compile_commands.json.

bon-ami commented 3 months ago

I've got a similar failure, not sure whether to continue here or post a new issue. clang --target=x86_64-w64-mingw32 test.c OK using clangd as LSP in neovim (with ale as the plugin) fails. Thanks in advance. #include <stdio.h> generates 'stdio.h' file not found %USER%\AppData\Local\clangd\config.yaml

CompileFlags:
  Add: --target=x86_64-w64-mingw64

complile_flags.txt under same dir as test.c

--target=x86_64-w64-mingw64
HighCommander4 commented 3 months ago

@bon-ami Please start by reading https://clangd.llvm.org/troubleshooting.html#cant-find-standard-library-headers-map-stdioh-etc, and using --query-driver in particular (which is mentioned as being necessary for MinGW).

If you can't get it to work, please file a new issue and attach clangd logs.

bon-ami commented 3 months ago

it turns out to be clang-tidy, instead of clangd that reported the failure. the config.yaml works. since it seems clang-tidy does not support windows, I'm using clangd only now. Thanks any way.