Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clangd does not recognize c++ standard library headers #2018

Open
zemanpeter opened this issue Apr 20, 2024 · 10 comments
Open

clangd does not recognize c++ standard library headers #2018

zemanpeter opened this issue Apr 20, 2024 · 10 comments

Comments

@zemanpeter
Copy link

I am using neovim and clangd. I set up neovim using nvchad and clangd exactly according to this video (https://www.youtube.com/watch?v=lsFoZIg-oDs) many months ago mainly for the purpose of autocompletion. Then I did not use c++ for a while and now I have problem with clangd recognizing standard c++ headder files. The autocompletions works. The only real change that happened in between on my system must have been the latest updates of macOS.

image

I tried to google a lot of things and also look at the clangd troubleshooting. It usually advices to set up a "compile_commands.json" file, but I did not have to do this before and it worked. Also, I tried this solution, but nothing changed.

System information

Output of clangd --version:

Apple clangd version 15.0.0 (clang-1500.3.9.4)
Features: mac+xpc
Platform: x86_64-apple-darwin23.4.0

Editor/LSP plugin:

neovim

Operating system:

macOS Sonoma 14.4.1

@HighCommander4
Copy link

Please start by looking at

https://clangd.llvm.org/troubleshooting#cant-find-standard-library-headers-map-stdioh-etc

and

https://clangd.llvm.org/guides/system-headers#query-driver

--query-driver in particular tends to resolve this category of issue.

@zemanpeter
Copy link
Author

https://clangd.llvm.org/guides/system-headers#query-driver

--query-driver in particular tends to resolve this category of issue.

Thank you very much, this is definitely a progress! I have added the line
cmd = {"clangd", "--query-driver=/usr/bin/clang"}
to one of the configuration files in nvim:

local base = require("plugins.configs.lspconfig")
local on_attach = base.on_attach
local capabilities = base.capabilities

--disable snippets
--capabilities.textDocument.completion.completionItem.snippetSupport = false

local lspconfig = require("lspconfig")

-- fixing some clangd + nvchad bug
lspconfig.clangd.setup({
  on_attach = function(client, bufnr)
    client.server_capabilities.signatureHelpProvider = false
    on_attach(client, bufnr)
  end,
  capabilities = capabilities,
  cmd = {"clangd", "--query-driver=/usr/bin/clang"}
})

This is great, but I would still like to understand why this suddenly happened and why it worked without this line before.

@zemanpeter
Copy link
Author

Thank you very much, this is definitely a progress! I have added the line cmd = {"clangd", "--query-driver=/usr/bin/clang"} to one of the configuration files in nvim:

Also I realized on more thing: this solution for some reason messes up the colorscheme -- all the variables are green (in the case of the colorscheme I am using) instead of just white.

@HighCommander4
Copy link

I would still like to understand why this suddenly happened and why it worked without this line before

If you share verbose logs without --query-driver, that might shed light on this question.

@zemanpeter
Copy link
Author

If you share verbose logs without --query-driver, that might shed light on this question.

Thank you very much!

It is quite a mess, but here is the log file.

[START][2024-04-22 12:04:49] LSP logging initiated
[INFO][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:662	"Starting RPC client"	{  args = { "--log=error" },  cmd = "/Users/peterzeman/.local/share/nvim/mason/bin/clangd",  extra = {    cwd = "/Users/peterzeman"  }}
[TRACE][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1306	"LSP[clangd]"	"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 = true,          deprecatedSupport = true,          documentationFormat = { "markdown", "plaintext" },          insertReplaceSupport = true,          labelDetailsSupport = true,          preselectSupport = true,          resolveSupport = {            properties = { "documentation", "detail", "additionalTextEdits" }          },          snippetSupport = true,          tagSupport = {            valueSet = { 1 }          }        },        completionItemKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }        },        contextSupport = 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 = vim.empty_dict(),  processId = 10284,  rootPath = vim.NIL,  rootUri = vim.NIL,  trace = "off",  workspaceFolders = vim.NIL}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  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 = true,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = { "documentation", "detail", "additionalTextEdits" }            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          contextSupport = 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 = vim.empty_dict(),    processId = 10284,    rootPath = vim.NIL,    rootUri = vim.NIL,    trace = "off",    workspaceFolders = vim.NIL  }}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  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) mac+grpc+xpc x86_64-apple-darwin23.4.0"    }  }}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[INFO][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1344	"LSP[clangd]"	"server_capabilities"	{  server_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  }}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "cpp",      text = '#include <iostream>\n#include <algorithm>\nusing namespace std;\nint main() {\n  int a = 0;\n  int b = 0;\n  cout << "Hello" << endl;\n  return 0;\n}\n',      uri = "file:///Users/peterzeman/test.cpp",      version = 0    }  }}
[DEBUG][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1391	"LSP[clangd]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///Users/peterzeman/test.cpp"  }}	<function 1>	1
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 2,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///Users/peterzeman/test.cpp"    }  }}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 0,  jsonrpc = "2.0",  method = "workspace/semanticTokens/refresh"}
[TRACE][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1066	"server_request"	"workspace/semanticTokens/refresh"	nil
[TRACE][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1069	"server_request: found handler for"	"workspace/semanticTokens/refresh"
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "$/cancelRequest",  params = {    id = 2  }}
[DEBUG][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1391	"LSP[clangd]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///Users/peterzeman/test.cpp"  }}	<function 1>	1
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///Users/peterzeman/test.cpp"    }  }}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:403	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 0,  jsonrpc = "2.0",  result = vim.NIL}
[ERROR][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"E[12:04:49.166] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\nE[12:04:49.166] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\n"
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = { {        code = "pp_file_not_found",        message = "'iostream' file not found",        range = {          ["end"] = {            character = 19,            line = 0          },          start = {            character = 9,            line = 0          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "ext_using_undefined_std",        message = "Using directive refers to implicitly-defined namespace 'std'",        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 16,            line = 2          }        },        relatedInformation = {},        severity = 2,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'cout'",        range = {          ["end"] = {            character = 6,            line = 6          },          start = {            character = 2,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'endl'",        range = {          ["end"] = {            character = 25,            line = 6          },          start = {            character = 21,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      } },    uri = "file:///Users/peterzeman/test.cpp",    version = 0  }}
[TRACE][2024-04-22 12:04:49] .../lua/vim/lsp.lua:1052	"notification"	"textDocument/publishDiagnostics"	{  diagnostics = { {      code = "pp_file_not_found",      message = "'iostream' file not found",      range = {        ["end"] = {          character = 19,          line = 0        },        start = {          character = 9,          line = 0        }      },      relatedInformation = {},      severity = 1,      source = "clang"    }, {      code = "ext_using_undefined_std",      message = "Using directive refers to implicitly-defined namespace 'std'",      range = {        ["end"] = {          character = 19,          line = 2        },        start = {          character = 16,          line = 2        }      },      relatedInformation = {},      severity = 2,      source = "clang"    }, {      code = "undeclared_var_use",      message = "Use of undeclared identifier 'cout'",      range = {        ["end"] = {          character = 6,          line = 6        },        start = {          character = 2,          line = 6        }      },      relatedInformation = {},      severity = 1,      source = "clang"    }, {      code = "undeclared_var_use",      message = "Use of undeclared identifier 'endl'",      range = {        ["end"] = {          character = 25,          line = 6        },        start = {          character = 21,          line = 6        }      },      relatedInformation = {},      severity = 1,      source = "clang"    } },  uri = "file:///Users/peterzeman/test.cpp",  version = 0}
[TRACE][2024-04-22 12:04:49] ...lsp/handlers.lua:618	"default_handler"	"textDocument/publishDiagnostics"	{  ctx = '{\n  client_id = 1,\n  method = "textDocument/publishDiagnostics"\n}',  result = {    diagnostics = { {        code = "pp_file_not_found",        message = "'iostream' file not found",        range = {          ["end"] = {            character = 19,            line = 0          },          start = {            character = 9,            line = 0          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "ext_using_undefined_std",        message = "Using directive refers to implicitly-defined namespace 'std'",        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 16,            line = 2          }        },        relatedInformation = {},        severity = 2,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'cout'",        range = {          ["end"] = {            character = 6,            line = 6          },          start = {            character = 2,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'endl'",        range = {          ["end"] = {            character = 25,            line = 6          },          start = {            character = 21,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      } },    uri = "file:///Users/peterzeman/test.cpp",    version = 0  }}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  error = {    code = -32800,    message = "Request cancelled"  },  id = 2,  jsonrpc = "2.0"}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:457	"Received cancellation ack"	{  error = {    code = -32800,    message = "Request cancelled"  },  id = 2,  jsonrpc = "2.0"}
[DEBUG][2024-04-22 12:04:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 3,  jsonrpc = "2.0",  result = {    data = { 2, 16, 3, 15, 131072, 1, 4, 4, 3, 131075, 1, 6, 1, 1, 16387, 1, 6, 1, 1, 16387 },    resultId = "1"  }}
[DEBUG][2024-04-22 12:04:50] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didSave",  params = {    textDocument = {      uri = "file:///Users/peterzeman/test.cpp"    }  }}
[INFO][2024-04-22 12:04:50] .../lua/vim/lsp.lua:1875	"exit_handler"	{ {    _on_attach = <function 1>,    attached_buffers = { true },    cancel_request = <function 2>,    commands = {},    config = {      _on_attach = <function 3>,      autostart = true,      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 = true,              deprecatedSupport = true,              documentationFormat = { "markdown", "plaintext" },              insertReplaceSupport = true,              labelDetailsSupport = true,              preselectSupport = true,              resolveSupport = {                properties = { "documentation", "detail", "additionalTextEdits" }              },              snippetSupport = true,              tagSupport = {                valueSet = { 1 }              }            },            completionItemKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }            },            contextSupport = 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        }      },      cmd = { "/Users/peterzeman/.local/share/nvim/mason/bin/clangd", "--log=error" },      cmd_cwd = "/Users/peterzeman",      filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },      flags = {},      get_language_id = <function 4>,      handlers = <1>{},      init_options = vim.empty_dict(),      log_level = 2,      message_level = 2,      name = "clangd",      on_attach = <function 5>,      on_exit = <function 6>,      on_init = <function 7>,      settings = vim.empty_dict(),      single_file_support = true,      <metatable> = <2>{        __tostring = <function 8>      }    },    handlers = <table 1>,    id = 1,    initialized = true,    is_stopped = <function 9>,    messages = {      messages = {},      name = "clangd",      progress = {},      status = {}    },    name = "clangd",    notify = <function 10>,    offset_encoding = "utf-8",    request = <function 11>,    request_sync = <function 12>,    requests = {},    rpc = {      is_closing = <function 13>,      notify = <function 14>,      request = <function 15>,      terminate = <function 16>    },    server_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 = false,      standardTypeHierarchyProvider = true,      textDocumentSync = {        change = 2,        openClose = true,        save = true      },      typeDefinitionProvider = true,      typeHierarchyProvider = true,      workspaceSymbolProvider = true    },    stop = <function 17>,    supports_method = <function 18>,    workspace_did_change_configuration = <function 19>  } }
[DEBUG][2024-04-22 12:04:50] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  method = "shutdown"}
[DEBUG][2024-04-22 12:04:50] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 4,  jsonrpc = "2.0"}
[DEBUG][2024-04-22 12:04:50] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "exit"}

@HighCommander4
Copy link

It is quite a mess, but here is the log file.

Unfortunately these logs are incomplete. I'm looking for the full stderr from the server, these seem to include only one line from the server's stderr, and a bunch of client-side logging.

@zemanpeter
Copy link
Author

Unfortunately these logs are incomplete. I'm looking for the full stderr from the server, these seem to include only one line from the server's stderr, and a bunch of client-side logging.

Thank you!

I used the verbose option now. I do not know why I did not use it before.

[START][2024-04-24 09:02:43] LSP logging initiated
[INFO][2024-04-24 09:02:43] .../vim/lsp/rpc.lua:662	"Starting RPC client"	{  args = { "--log=verbose" },  cmd = "/Users/peterzeman/.local/share/nvim/mason/bin/clangd",  extra = {    cwd = "/Users/peterzeman"  }}
[TRACE][2024-04-24 09:02:43] .../lua/vim/lsp.lua:1306	"LSP[clangd]"	"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 = true,          deprecatedSupport = true,          documentationFormat = { "markdown", "plaintext" },          insertReplaceSupport = true,          labelDetailsSupport = true,          preselectSupport = true,          resolveSupport = {            properties = { "documentation", "detail", "additionalTextEdits" }          },          snippetSupport = true,          tagSupport = {            valueSet = { 1 }          }        },        completionItemKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }        },        contextSupport = 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 = vim.empty_dict(),  processId = 19185,  rootPath = vim.NIL,  rootUri = vim.NIL,  trace = "off",  workspaceFolders = vim.NIL}
[DEBUG][2024-04-24 09:02:43] .../vim/lsp/rpc.lua:284	"rpc.send"	{  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 = true,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = { "documentation", "detail", "additionalTextEdits" }            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          contextSupport = 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 = vim.empty_dict(),    processId = 19185,    rootPath = vim.NIL,    rootUri = vim.NIL,    trace = "off",    workspaceFolders = vim.NIL  }}
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[09:02:47.798] clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)\nI[09:02:47.799] Features: mac+grpc+xpc\nI[09:02:47.799] PID: 19194\nI[09:02:47.799] Working directory: /Users/peterzeman\nI[09:02:47.799] argv[0]: /Users/peterzeman/.local/share/nvim/mason/bin/clangd\nI[09:02:47.799] argv[1]: --log=verbose\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.799] User config file is /Users/peterzeman/Library/Preferences/clangd/config.yaml\nI[09:02:47.799] Starting LSP over stdin/stdout\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.799] <<< {"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":true,"deprecatedSupport":true,"documentationFormat":["markdown","plaintext"],"insertReplaceSupport":true,"labelDetailsSupport":true,"preselectSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"contextSupport":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":19185,"rootPath":null,"rootUri":null,"trace":"off","workspaceFolders":null}}\n\nI[09:02:47.800] <-- initialize(1)\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.802] Invoking /usr/bin/xcrun to find clang installation\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.826] Invoking /usr/bin/xcrun to find clang installation\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[09:02:47.837] --> reply:initialize(1) 37 ms\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.837] >>> {"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) mac+grpc+xpc x86_64-apple-darwin23.4.0"}}}\n\n'
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  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) mac+grpc+xpc x86_64-apple-darwin23.4.0"    }  }}
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[INFO][2024-04-24 09:02:47] .../lua/vim/lsp.lua:1344	"LSP[clangd]"	"server_capabilities"	{  server_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  }}
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "cpp",      text = '#include <iostream>\n#include <algorithm>\nusing namespace std;\nint main() {\n  int a = 0;\n  int b = 0;\n  cout << "Hello" << endl;\n  return 0;\n}\n',      uri = "file:///Users/peterzeman/test.cpp",      version = 0    }  }}
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.839] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}\n\nI[09:02:47.839] <-- initialized\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.839] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"#include <iostream>\\n#include <algorithm>\\nusing namespace std;\\nint main() {\\n  int a = 0;\\n  int b = 0;\\n  cout << \\"Hello\\" << endl;\\n  return 0;\\n}\\n","uri":"file:///Users/peterzeman/test.cpp","version":0}}}\n\nI[09:02:47.839] <-- textDocument/didOpen\n'
[DEBUG][2024-04-24 09:02:47] .../lua/vim/lsp.lua:1391	"LSP[clangd]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///Users/peterzeman/test.cpp"  }}	<function 1>	1
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 2,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///Users/peterzeman/test.cpp"    }  }}
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.841] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///Users/peterzeman/test.cpp"}}}\n\nI[09:02:47.841] <-- textDocument/semanticTokens/full(2)\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[09:02:47.844] Failed to find compilation database for /Users/peterzeman/test.cpp\nI[09:02:47.844] ASTWorker building file /Users/peterzeman/test.cpp version 0 with command clangd fallback\n[/Users/peterzeman]\n/Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -- /Users/peterzeman/test.cpp\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.849] Driver produced command: cc1 -cc1 -triple x86_64-apple-macosx14.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=14.4 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fbuiltin-headers-in-system-modules -fdefine-target-os-macros -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -fdebug-compilation-dir=/Users/peterzeman -target-linker-version 820.1 -fcoverage-compilation-dir=/Users/peterzeman -resource-dir /Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -internal-isystem /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -fdeprecated-macro -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fmax-type-align=16 -no-round-trip-args -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /Users/peterzeman/test.cpp\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.849] Building first preamble for /Users/peterzeman/test.cpp version 0\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[09:02:47.866] Built preamble of size 225016 for file /Users/peterzeman/test.cpp version 0 in 0.02 seconds\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'I[09:02:47.867] --> workspace/semanticTokens/refresh(0)\nV[09:02:47.867] >>> {"id":0,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}\n\n'
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 0,  jsonrpc = "2.0",  method = "workspace/semanticTokens/refresh"}
[TRACE][2024-04-24 09:02:47] .../lua/vim/lsp.lua:1066	"server_request"	"workspace/semanticTokens/refresh"	nil
[TRACE][2024-04-24 09:02:47] .../lua/vim/lsp.lua:1069	"server_request: found handler for"	"workspace/semanticTokens/refresh"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.867] indexed preamble AST for /Users/peterzeman/test.cpp version 0:\n  symbol slab: 0 symbols, 120 bytes\n  ref slab: 0 symbols, 0 refs, 128 bytes\n  relations slab: 0 relations, 24 bytes\n"
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "$/cancelRequest",  params = {    id = 2  }}
[DEBUG][2024-04-24 09:02:47] .../lua/vim/lsp.lua:1391	"LSP[clangd]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///Users/peterzeman/test.cpp"  }}	<function 1>	1
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///Users/peterzeman/test.cpp"    }  }}
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:403	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 0,  jsonrpc = "2.0",  result = vim.NIL}
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.868] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}\n\nI[09:02:47.868] <-- $/cancelRequest\nV[09:02:47.868] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///Users/peterzeman/test.cpp"}}}\n\nI[09:02:47.868] <-- textDocument/semanticTokens/full(3)\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.868] <<< {"id":0,"jsonrpc":"2.0","result":null}\n\nI[09:02:47.868] <-- reply(0)\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.873] Trying to fix unresolved name "cout" in scopes: [, std::]\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:47.873] Trying to fix unresolved name "endl" in scopes: [, std::]\n'
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"E[09:02:47.874] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\nE[09:02:47.874] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"V[09:02:47.874] indexed file AST for /Users/peterzeman/test.cpp version 0:\n  symbol slab: 1 symbols, 4448 bytes\n  ref slab: 1 symbols, 1 refs, 4248 bytes\n  relations slab: 0 relations, 24 bytes\nV[09:02:47.874] Build dynamic index for main-file symbols with estimated memory usage of 11520 bytes\n"
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[09:02:47.874] --> textDocument/publishDiagnostics\nV[09:02:47.874] >>> {\"jsonrpc\":\"2.0\",\"method\":\"textDocument/publishDiagnostics\",\"params\":{\"diagnostics\":[{\"code\":\"pp_file_not_found\",\"message\":\"'iostream' file not found\",\"range\":{\"end\":{\"character\":19,\"line\":0},\"start\":{\"character\":9,\"line\":0}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"ext_using_undefined_std\",\"message\":\"Using directive refers to implicitly-defined namespace 'std'\",\"range\":{\"end\":{\"character\":19,\"line\":2},\"start\":{\"character\":16,\"line\":2}},\"relatedInformation\":[],\"severity\":2,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'cout'\",\"range\":{\"end\":{\"character\":6,\"line\":6},\"start\":{\"character\":2,\"line\":6}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"},{\"code\":\"undeclared_var_use\",\"message\":\"Use of undeclared identifier 'endl'\",\"range\":{\"end\":{\"character\":25,\"line\":6},\"start\":{\"character\":21,\"line\":6}},\"relatedInformation\":[],\"severity\":1,\"source\":\"clang\"}],\"uri\":\"file:///Users/peterzeman/test.cpp\",\"version\":0}}\n\n"
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = { {        code = "pp_file_not_found",        message = "'iostream' file not found",        range = {          ["end"] = {            character = 19,            line = 0          },          start = {            character = 9,            line = 0          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "ext_using_undefined_std",        message = "Using directive refers to implicitly-defined namespace 'std'",        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 16,            line = 2          }        },        relatedInformation = {},        severity = 2,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'cout'",        range = {          ["end"] = {            character = 6,            line = 6          },          start = {            character = 2,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'endl'",        range = {          ["end"] = {            character = 25,            line = 6          },          start = {            character = 21,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      } },    uri = "file:///Users/peterzeman/test.cpp",    version = 0  }}
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  error = {    code = -32800,    message = "Request cancelled"  },  id = 2,  jsonrpc = "2.0"}
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:457	"Received cancellation ack"	{  error = {    code = -32800,    message = "Request cancelled"  },  id = 2,  jsonrpc = "2.0"}
[TRACE][2024-04-24 09:02:47] .../lua/vim/lsp.lua:1052	"notification"	"textDocument/publishDiagnostics"	{  diagnostics = { {      code = "pp_file_not_found",      message = "'iostream' file not found",      range = {        ["end"] = {          character = 19,          line = 0        },        start = {          character = 9,          line = 0        }      },      relatedInformation = {},      severity = 1,      source = "clang"    }, {      code = "ext_using_undefined_std",      message = "Using directive refers to implicitly-defined namespace 'std'",      range = {        ["end"] = {          character = 19,          line = 2        },        start = {          character = 16,          line = 2        }      },      relatedInformation = {},      severity = 2,      source = "clang"    }, {      code = "undeclared_var_use",      message = "Use of undeclared identifier 'cout'",      range = {        ["end"] = {          character = 6,          line = 6        },        start = {          character = 2,          line = 6        }      },      relatedInformation = {},      severity = 1,      source = "clang"    }, {      code = "undeclared_var_use",      message = "Use of undeclared identifier 'endl'",      range = {        ["end"] = {          character = 25,          line = 6        },        start = {          character = 21,          line = 6        }      },      relatedInformation = {},      severity = 1,      source = "clang"    } },  uri = "file:///Users/peterzeman/test.cpp",  version = 0}
[TRACE][2024-04-24 09:02:47] ...lsp/handlers.lua:618	"default_handler"	"textDocument/publishDiagnostics"	{  ctx = '{\n  client_id = 1,\n  method = "textDocument/publishDiagnostics"\n}',  result = {    diagnostics = { {        code = "pp_file_not_found",        message = "'iostream' file not found",        range = {          ["end"] = {            character = 19,            line = 0          },          start = {            character = 9,            line = 0          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "ext_using_undefined_std",        message = "Using directive refers to implicitly-defined namespace 'std'",        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 16,            line = 2          }        },        relatedInformation = {},        severity = 2,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'cout'",        range = {          ["end"] = {            character = 6,            line = 6          },          start = {            character = 2,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      }, {        code = "undeclared_var_use",        message = "Use of undeclared identifier 'endl'",        range = {          ["end"] = {            character = 25,            line = 6          },          start = {            character = 21,            line = 6          }        },        relatedInformation = {},        severity = 1,        source = "clang"      } },    uri = "file:///Users/peterzeman/test.cpp",    version = 0  }}
[ERROR][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'I[09:02:47.875] --> reply:textDocument/semanticTokens/full(2) 33 ms, error: Task was cancelled.\nV[09:02:47.875] >>> {"error":{"code":-32800,"message":"Request cancelled"},"id":2,"jsonrpc":"2.0"}\n\nV[09:02:47.875] ASTWorker running SemanticHighlights on version 0 of /Users/peterzeman/test.cpp\nI[09:02:47.875] --> reply:textDocument/semanticTokens/full(3) 6 ms\nV[09:02:47.875] >>> {"id":3,"jsonrpc":"2.0","result":{"data":[2,16,3,15,131072,1,4,4,3,131075,1,6,1,1,16387,1,6,1,1,16387],"resultId":"1"}}\n\n'
[DEBUG][2024-04-24 09:02:47] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 3,  jsonrpc = "2.0",  result = {    data = { 2, 16, 3, 15, 131072, 1, 4, 4, 3, 131075, 1, 6, 1, 1, 16387, 1, 6, 1, 1, 16387 },    resultId = "1"  }}
[DEBUG][2024-04-24 09:02:58] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didSave",  params = {    textDocument = {      uri = "file:///Users/peterzeman/test.cpp"    }  }}
[INFO][2024-04-24 09:02:58] .../lua/vim/lsp.lua:1875	"exit_handler"	{ {    _on_attach = <function 1>,    attached_buffers = { true },    cancel_request = <function 2>,    commands = {},    config = {      _on_attach = <function 3>,      autostart = true,      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 = true,              deprecatedSupport = true,              documentationFormat = { "markdown", "plaintext" },              insertReplaceSupport = true,              labelDetailsSupport = true,              preselectSupport = true,              resolveSupport = {                properties = { "documentation", "detail", "additionalTextEdits" }              },              snippetSupport = true,              tagSupport = {                valueSet = { 1 }              }            },            completionItemKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }            },            contextSupport = 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        }      },      cmd = { "/Users/peterzeman/.local/share/nvim/mason/bin/clangd", "--log=verbose" },      cmd_cwd = "/Users/peterzeman",      filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },      flags = {},      get_language_id = <function 4>,      handlers = <1>{},      init_options = vim.empty_dict(),      log_level = 2,      message_level = 2,      name = "clangd",      on_attach = <function 5>,      on_exit = <function 6>,      on_init = <function 7>,      settings = vim.empty_dict(),      single_file_support = true,      <metatable> = <2>{        __tostring = <function 8>      }    },    handlers = <table 1>,    id = 1,    initialized = true,    is_stopped = <function 9>,    messages = {      messages = {},      name = "clangd",      progress = {},      status = {}    },    name = "clangd",    notify = <function 10>,    offset_encoding = "utf-8",    request = <function 11>,    request_sync = <function 12>,    requests = {},    rpc = {      is_closing = <function 13>,      notify = <function 14>,      request = <function 15>,      terminate = <function 16>    },    server_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 = false,      standardTypeHierarchyProvider = true,      textDocumentSync = {        change = 2,        openClose = true,        save = true      },      typeDefinitionProvider = true,      typeHierarchyProvider = true,      workspaceSymbolProvider = true    },    stop = <function 17>,    supports_method = <function 18>,    workspace_did_change_configuration = <function 19>  } }
[DEBUG][2024-04-24 09:02:58] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  method = "shutdown"}
[ERROR][2024-04-24 09:02:58] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/peterzeman/.local/share/nvim/mason/bin/clangd"	"stderr"	'V[09:02:58.521] <<< {"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///Users/peterzeman/test.cpp"}}}\n\nI[09:02:58.521] <-- textDocument/didSave\nI[09:02:58.521] File version went from 0 to 0\nV[09:02:58.524] <<< {"id":4,"jsonrpc":"2.0","method":"shutdown"}\n\nI[09:02:58.524] <-- shutdown(4)\nI[09:02:58.524] --> reply:shutdown(4) 0 ms\nV[09:02:58.524] >>> {"id":4,"jsonrpc":"2.0","result":null}\n\n'
[DEBUG][2024-04-24 09:02:58] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 4,  jsonrpc = "2.0"}
[DEBUG][2024-04-24 09:02:58] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "exit"}

@HighCommander4
Copy link

Ok, so the relevant parts of the log are:

I[09:02:47.844] ASTWorker building file /Users/peterzeman/test.cpp version 0 with command clangd fallback
[/Users/peterzeman]
/Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -- /Users/peterzeman/test.cpp

In the absence of --query-driver, what clangd has to go on to try to find standard library headers is basically the compiler path from the file's compile command, /Library/Developer/CommandLineTools/usr/bin/clang.

And then:

V[09:02:47.849] Driver produced command: cc1 -cc1 -triple x86_64-apple-macosx14.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=14.4 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fbuiltin-headers-in-system-modules -fdefine-target-os-macros -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -fdebug-compilation-dir=/Users/peterzeman -target-linker-version 820.1 -fcoverage-compilation-dir=/Users/peterzeman -resource-dir /Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -internal-isystem /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -fdeprecated-macro -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fmax-type-align=16 -no-round-trip-args -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /Users/peterzeman/test.cpp

which tells us that, based on this compiler path, clangd came up with the following system include directories:

-internal-isystem /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
-internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include
-internal-isystem /Users/peterzeman/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18/include
-internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include 

The path for C++ standard library includes, in particular, is /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1. As you can see, it's expressed relative to the path containing the compiler executable, /Library/Developer/CommandLineTools/usr/bin.

Presumably, if you're getting unresolved include errors, this path (/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1) does not exist?

@zemanpeter
Copy link
Author

Presumably, if you're getting unresolved include errors, this path (/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1) does not exist?

Ok, I see the problem. The path exists, but for some reason it does not contain the include files that I am looking for only some that I am absolutely not familiar with:

__cxx_version     __cxxabi_config.h cxxabi.h

__bit:
bit_cast.h

__charconv:
chars_format.h      from_chars_result.h to_chars_result.h

__compare:
common_comparison_category.h compare_three_way_result.h   ordering.h                   three_way_comparable.h
compare_three_way.h          is_eq.h                      synth_three_way.h

__concepts:
arithmetic.h            common_reference_with.h copyable.h              equality_comparable.h   regular.h               swappable.h
assignable.h            common_with.h           derived_from.h          invocable.h             relation.h              totally_ordered.h
boolean_testable.h      constructible.h         destructible.h          movable.h               same_as.h
class_or_enum.h         convertible_to.h        different_from.h        predicate.h             semiregular.h

__format:
format_arg.h             format_context.h         format_string.h          formatter_bool.h         formatter_integer.h      formatter_string.h
format_args.h            format_fwd.h             formatter.h              formatter_char.h         formatter_integral.h     parser_std_format_spec.h

__functional:
bind_back.h compose.h

__iterator:
unreachable_sentinel.h

__ranges:
counted.h       iota_view.h     join_view.h     range_adaptor.h reverse_view.h  single_view.h   take_view.h

__utility:
decay_copy.h

@zemanpeter
Copy link
Author

The path for C++ standard library includes, in particular, is /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1. As you can see, it's expressed relative to the path containing the compiler executable, /Library/Developer/CommandLineTools/usr/bin.

Ok, so I found out that the path for C++ standard library includes actually is
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants