clangd / coc-clangd

clangd extension for coc.nvim
Apache License 2.0
757 stars 34 forks source link

Inlay hint regression #680

Closed shyun3 closed 2 months ago

shyun3 commented 2 months ago

Wasn't sure where to raise this issue, but inlay hints no longer seem to work as of commit ba3c0a9 in the main coc.nvim plugin. They work fine for previous commits.

Test file

void f(int i)
{
}

int main()
{
    f(5);
}

A hint should be shown in the call to f() but it is not. Toggling the inlay hints using :CocCommand document.toggleInlayHint results in the error message [coc.nvim] Inlay hint provider not found for current document.

Logs

I[11:00:52.240] Ubuntu clangd version 18.1.6 (++20240518023229+1118c2e05e67-1~exp1~20240518143321.130)
I[11:00:52.240] Features: linux+grpc
I[11:00:52.240] PID: 62581
I[11:00:52.240] Working directory: /home/mhyun/tmp
I[11:00:52.240] argv[0]: /home/mhyun/bin/clangd
I[11:00:52.240] argv[1]: --log=verbose
V[11:00:52.240] User config file is /home/mhyun/.config/clangd/config.yaml
I[11:00:52.240] Starting LSP over stdin/stdout
V[11:00:52.241] <<< {"id":0,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"marked","version":"7.0.5"},"positionEncodings":["utf-16"],"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/inlayHint","textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]}},"textDocument":{"callHierarchy":{"dynamicRegistration":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"dynamicRegistration":true,"honorsChangeAnnotations":false,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"codeLens":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},"completion":{"completionItem":{"commitCharactersSupport":true,"deprecatedSupport":true,"documentationFormat":["markdown","plaintext"],"insertReplaceSupport":true,"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true,"preselectSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextFormat","insertTextMode"]},"contextSupport":true,"dynamicRegistration":true,"editsNearCursor":true,"insertTextMode":2},"declaration":{"dynamicRegistration":true,"linkSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"diagnostic":{"dynamicRegistration":true,"relatedDocumentSupport":true},"documentHighlight":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"documentSymbol":{"dynamicRegistration":true,"hierarchicalDocumentSymbolSupport":true,"labelSupport":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"foldingRange":{"dynamicRegistration":true,"foldingRange":{"collapsedText":false},"foldingRangeKind":{"valueSet":["comment","imports","region"]},"lineFoldingOnly":true,"rangeLimit":5000},"formatting":{"dynamicRegistration":true},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"inlineValue":{"dynamicRegistration":true},"linkedEditingRange":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"codeDescriptionSupport":true,"dataSupport":true,"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":true},"rangeFormatting":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"honorsChangeAnnotations":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1},"selectionRange":{"dynamicRegistration":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":true,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":false,"requests":{"full":{"delta":true},"range":true},"serverCancelSupport":true,"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","decorator","operator"]},"signatureHelp":{"contextSupport":true,"dynamicRegistration":true,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"typeHierarchy":{"dynamicRegistration":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"workDoneProgress":true},"workspace":{"applyEdit":true,"codeLens":{"refreshSupport":true},"configuration":true,"diagnostics":{"refreshSupport":true},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"executeCommand":{"dynamicRegistration":true},"fileOperations":{"didCreate":true,"didDelete":true,"didRename":true,"dynamicRegistration":true,"willCreate":true,"willDelete":true,"willRename":true},"inlineValue":{"refreshSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":true,"resolveSupport":{"properties":["location.range"]},"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"workspaceEdit":{"changeAnnotationSupport":{"groupsOnLabel":false},"documentChanges":true,"failureHandling":"undo","normalizesLineEndings":true,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"coc.nvim","version":"0.0.82"},"initializationOptions":{"clangdFileStatus":true,"fallbackFlags":[]},"locale":"C","processId":62564,"rootPath":"/home/mhyun/tmp","rootUri":"file:///home/mhyun/tmp","trace":"off","workDoneToken":"15c3b07a-f158-4dcb-92ab-20cd5ee0e163","workspaceFolders":[{"name":"tmp","uri":"file:///home/mhyun/tmp"}]}}

I[11:00:52.241] <-- initialize(0)
I[11:00:52.241] --> reply:initialize(0) 0 ms
V[11:00:52.241] >>> {"id":0,"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},"serverInfo":{"name":"clangd","version":"Ubuntu clangd version 18.1.6 (++20240518023229+1118c2e05e67-1~exp1~20240518143321.130) linux+grpc x86_64-pc-linux-gnu"}}}

V[11:00:52.243] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}

I[11:00:52.243] <-- initialized
V[11:00:52.249] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"void f(int i)\n{\n}\n\nint main()\n{\n    f(5);\n}\n","uri":"file:///home/mhyun/tmp/test.cpp","version":1}}}

I[11:00:52.249] <-- textDocument/didOpen
I[11:00:52.249] Failed to find compilation database for /home/mhyun/tmp/test.cpp
I[11:00:52.249] ASTWorker building file /home/mhyun/tmp/test.cpp version 1 with command clangd fallback
[/home/mhyun/tmp]
/usr/bin/clang -resource-dir=/usr/lib/llvm-18/lib/clang/18 -- /home/mhyun/tmp/test.cpp
V[11:00:52.250] Driver produced command: cc1 -cc1 -triple x86_64-pc-linux-gnu -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 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/mhyun/tmp -fcoverage-compilation-dir=/home/mhyun/tmp -resource-dir /usr/lib/llvm-18/lib/clang/18 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -no-round-trip-args -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /home/mhyun/tmp/test.cpp
I[11:00:52.250] --> textDocument/clangd.fileStatus
V[11:00:52.250] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Update","uri":"file:///home/mhyun/tmp/test.cpp"}}

V[11:00:52.250] Building first preamble for /home/mhyun/tmp/test.cpp version 1
I[11:00:52.256] Built preamble of size 222080 for file /home/mhyun/tmp/test.cpp version 1 in 0.01 seconds
I[11:00:52.256] --> workspace/semanticTokens/refresh(0)
V[11:00:52.256] >>> {"id":0,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}

I[11:00:52.256] --> textDocument/clangd.fileStatus
V[11:00:52.256] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Build AST","uri":"file:///home/mhyun/tmp/test.cpp"}}

I[11:00:52.256] --> textDocument/clangd.fileStatus
V[11:00:52.256] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, parsing main file","uri":"file:///home/mhyun/tmp/test.cpp"}}

V[11:00:52.257] indexed preamble AST for /home/mhyun/tmp/test.cpp version 1:
  symbol slab: 0 symbols, 120 bytes
  ref slab: 0 symbols, 0 refs, 128 bytes
  relations slab: 0 relations, 24 bytes
V[11:00:52.258] <<< {"id":0,"jsonrpc":"2.0","result":null}

I[11:00:52.258] Indexing c++17 standard library in the context of /home/mhyun/tmp/test.cpp
I[11:00:52.258] <-- reply(0)
V[11:00:52.261] indexed file AST for /home/mhyun/tmp/test.cpp version 1:
  symbol slab: 2 symbols, 4680 bytes
  ref slab: 2 symbols, 3 refs, 4272 bytes
  relations slab: 0 relations, 24 bytes
V[11:00:52.261] Build dynamic index for main-file symbols with estimated memory usage of 12072 bytes
I[11:00:52.261] --> textDocument/publishDiagnostics
V[11:00:52.261] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///home/mhyun/tmp/test.cpp","version":1}}

I[11:00:52.261] --> textDocument/clangd.fileStatus
V[11:00:52.261] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///home/mhyun/tmp/test.cpp"}}

V[11:00:52.360] <<< {"id":1,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///home/mhyun/tmp/test.cpp"}}}

I[11:00:52.360] <-- textDocument/semanticTokens/full(1)
V[11:00:52.360] ASTWorker running SemanticHighlights on version 1 of /home/mhyun/tmp/test.cpp
I[11:00:52.360] --> reply:textDocument/semanticTokens/full(1) 0 ms
V[11:00:52.360] >>> {"id":1,"jsonrpc":"2.0","result":{"data":[0,5,1,3,131075,0,6,1,2,16387,4,4,4,3,131075,2,4,1,3,131072],"resultId":"1"}}

I[11:00:52.360] --> textDocument/clangd.fileStatus
V[11:00:52.360] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///home/mhyun/tmp/test.cpp"}}

V[11:00:52.449] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/documentLink","params":{"textDocument":{"uri":"file:///home/mhyun/tmp/test.cpp"}}}

I[11:00:52.449] <-- textDocument/documentLink(2)
V[11:00:52.449] ASTWorker running DocumentLinks on version 1 of /home/mhyun/tmp/test.cpp
I[11:00:52.449] --> reply:textDocument/documentLink(2) 0 ms
V[11:00:52.449] >>> {"id":2,"jsonrpc":"2.0","result":[]}

I[11:00:52.449] --> textDocument/clangd.fileStatus
V[11:00:52.449] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///home/mhyun/tmp/test.cpp"}}

V[11:00:53.676] Ignored diagnostic. /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/coroutine:334:2:"the coroutine header requires -fcoroutines"
I[11:00:54.349] Indexed c++17 standard library (incomplete due to errors): 13667 symbols, 1815 filtered
V[11:00:54.407] Build dynamic index for header symbols with estimated memory usage of 8269444 bytes

System information Clangd version (from the log, or clangd --version):

Ubuntu clangd version 18.1.6 (++20240518023229+1118c2e05e67-1~exp1~20240518143321.130)
Features: linux+grpc
Platform: x86_64-pc-linux-gnu

clangd extension version (from :CocInfo): Is this for coc-clangd? This doesn't seem to show in :CocInfo, but my extension version is 0.30.2 Operating system: WSL Ubuntu