clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
625 stars 104 forks source link

Renaming will fail under certain circumstances #687

Open luo2430 opened 3 days ago

luo2430 commented 3 days ago

Steps to reproduce

  1. Create a new folder and open it with vscode
  2. Create a new file 'a.h' and type in
    extern int a;
  3. Create a new file 'a.cpp' and type in
    
    #include "a.h"

int a;

4. Use a tool (such as cmake) to generate the 'compile_commands.json' file
5. Execute 'clangd: Restart language server'
6. Open 'a.h' and then open 'a.cpp' (It's the same in reverse order)
7. Rename 'int a' and then it will be failed. (If you preview the rename, you will notice that the same place in a file has been modified twice. This problem also occurs when renaming function names or class names)
![image](https://github.com/user-attachments/assets/b5f26c85-f846-4731-9289-cd1b2e2f9ef8)

### Description
This issue seems to have come up a long time ago, not a recent update. When renaming failed in the past I always thought it was because the extension wasn't powerful enough until one time I previewed renaming.
I came up with a temporary solution by adding the following code inside the {} of 'middleware' in the 'clangd-context.ts' file.

provideRenameEdits: async (document, position, newName, token, next) => { let edits = await next(document, position, newName, token); // Since edits doesn't provide a member function to modify it, I had to create a new variable let new_edits = new vscode.WorkspaceEdit; edits?.entries().map(entry => { / For performance reasons, since the same place is renamed twice, the operation is performed only if the number of modifications is even / if (entry[1].length % 2 == 0) { / When the file has problems renaming symbols, the modifications are listed as "change1, change2, change3, change1, change2, change3". So as long as "entry[1][0].range.isEqual(entry[1][index].range" is true, that means there was a renaming error / const index = entry[1].length / 2; if (entry[1][0].range.isEqual(entry[1][index].range)) { entry[1].splice(index); } } // Insert elements new_edits.set(entry[0], entry[1]); }); return new_edits; }


### Logs

V[18:05:14.219] <<< {"id":29,"jsonrpc":"2.0","method":"textDocument/rename","params":{"newName":"ClassName1","position":{"character":10,"line":4},"textDocument":{"uri":"file:///c%3A/Users/24306/Desktop/abcd/main.cpp"}}}

I[18:05:14.219] <-- textDocument/rename(29) V[18:05:14.220] ASTWorker running Rename on version 1 of c:/Users/24306/Desktop/abcd/main.cpp I[18:05:14.221] --> reply:textDocument/rename(29) 1 ms V[18:05:14.221] >>> {"id":29,"jsonrpc":"2.0","result":{"changes":{"file:///C:/Users/24306/Desktop/abcd/main.h":[{"newText":"ClassName1","range":{"end":{"character":15,"line":0},"start":{"character":6,"line":0}}},{"newText":"ClassName1","range":{"end":{"character":13,"line":2},"start":{"character":4,"line":2}}}],"file:///c:/Users/24306/Desktop/abcd/main.cpp":[{"newText":"ClassName1","range":{"end":{"character":13,"line":4},"start":{"character":4,"line":4}}}],"file:///c:/Users/24306/Desktop/abcd/main.h":[{"newText":"ClassName1","range":{"end":{"character":15,"line":0},"start":{"character":6,"line":0}}},{"newText":"ClassName1","range":{"end":{"character":13,"line":2},"start":{"character":4,"line":2}}}]}}}

I[18:05:14.221] --> textDocument/clangd.fileStatus V[18:05:14.221] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Desktop/abcd/main.cpp"}}

V[18:05:14.279] <<< {"id":30,"jsonrpc":"2.0","method":"textDocument/documentHighlight","params":{"position":{"character":10,"line":4},"textDocument":{"uri":"file:///c%3A/Users/24306/Desktop/abcd/main.cpp"}}}

I[18:05:14.279] <-- textDocument/documentHighlight(30) V[18:05:14.279] ASTWorker running Highlights on version 1 of c:/Users/24306/Desktop/abcd/main.cpp I[18:05:14.280] --> reply:textDocument/documentHighlight(30) 0 ms V[18:05:14.280] >>> {"id":30,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":13,"line":4},"start":{"character":4,"line":4}}}]}

I[18:05:14.280] --> textDocument/clangd.fileStatus V[18:05:14.280] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Desktop/abcd/main.cpp"}}


### System information

clangd version: 18.1.7 (git://code.qt.io/clang/llvm-project.git 393c912b8e044eb2a86dd9336f4915525bbc051c) Features: windows Platform: x86_64-w64-windows-gnu clangd extension version: v0.1.29 Operating system: Windows 11

HighCommander4 commented 15 hours ago

I'm not able to reproduce this. I'm testing with clangd 18, but on Linux rather than Windows.

In the log, I can see that the duplicate edits appear under two different files which differ only by case.

One is file:///C:/Users/24306/Desktop/abcd/main.h, and the other is file:///c:/Users/24306/Desktop/abcd/main.h. Note the driver letter is uppercase in the first one and lowercase in the second one.

So I think this is some sort of Windows-specific issue related to case-insensitive file systems.

luo2430 commented 15 hours ago

I'm not able to reproduce this. I'm testing with clangd 18, but on Linux rather than Windows.

In the log, I can see that the duplicate edits appear under two different files which differ only by case.

One is file:///C:/Users/24306/Desktop/abcd/main.h, and the other is file:///c:/Users/24306/Desktop/abcd/main.h. Note the driver letter is uppercase in the first one and lowercase in the second one.

So I think this is some sort of Windows-specific issue related to case-insensitive file systems.

@HighCommander4 Thanks for your reply. My temporary solution may be a little arbitrary, but it does work. Since it won't happen in linux, we can add if(process.platform == 'win32') for it. So will this problem be fixed?

HighCommander4 commented 15 hours ago

I think a proper fix to this is likely to be on the server side, something like https://github.com/clangd/clangd/issues/108.

That said, the issue may be avoidable with proper configuration. If you share a complete log (starting from clangd startup) that might contain some clues.

luo2430 commented 15 hours ago

I think a proper fix to this is likely to be on the server side, something like clangd/clangd#108.

That said, the issue may be avoidable with proper configuration. If you share a complete log (starting from clangd startup) that might contain some clues.

@HighCommander4 Well, then I'll just have to package my own extensions to solve this problem. It turns out that this problem has been around for a long time, but it still hasn't been solved, and I don't think it ever will be. I don't know how Jetbrains and QtCreator deal with this problem.

HighCommander4 commented 13 hours ago

That said, the issue may be avoidable with proper configuration. If you share a complete log (starting from clangd startup) that might contain some clues.

To elaborate a bit on what I mean by this: sometimes, the problem stems from an inconsistency in the compile_commands.json file, e.g. the value of the "file" key has C: in uppercase, but one of the -I flags has c: in lowercase, and resolving the inconsistency avoids the problem.

luo2430 commented 13 hours ago

That said, the issue may be avoidable with proper configuration. If you share a complete log (starting from clangd startup) that might contain some clues.

To elaborate a bit on what I mean by this: sometimes, the problem stems from an inconsistency in the compile_commands.json file, e.g. the value of the "file" key has C: in uppercase, but one of the -I flags has c: in lowercase, and resolving the inconsistency avoids the problem.

@HighCommander4 I checked the compile_commands.json built by cmake, it seems that there's no such inconsistency in it.

I[10:55:21.190] clangd version 18.1.7 (git://code.qt.io/clang/llvm-project.git 393c912b8e044eb2a86dd9336f4915525bbc051c)
I[10:55:21.191] Features: windows
I[10:55:21.191] PID: 3456
I[10:55:21.191] Working directory: c:/Users/24306/Documents/abc
I[10:55:21.191] argv[0]: C:/Qt/Tools/QtCreator/bin/clang/bin/clangd.exe
I[10:55:21.191] argv[1]: --all-scopes-completion=1
I[10:55:21.191] argv[2]: --clang-tidy=1
I[10:55:21.191] argv[3]: --completion-style=bundled
I[10:55:21.191] argv[4]: --fallback-style=WebKit
I[10:55:21.191] argv[5]: --header-insertion=never
I[10:55:21.191] argv[6]: --header-insertion-decorators=1
I[10:55:21.191] argv[7]: --enable-config=1
I[10:55:21.191] argv[8]: --log=verbose
V[10:55:21.193] User config file is C:/Users/24306/AppData/Local/clangd/config.yaml
I[10:55:21.193] Starting LSP over stdin/stdout
V[10:55:21.194] <<< {"id":0,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"marked","version":"1.1.0"},"positionEncodings":["utf-16"],"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]}},"notebookDocument":{"synchronization":{"dynamicRegistration":true,"executionSummarySupport":true}},"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":false},"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},"inactiveRegionsCapabilities":{"inactiveRegions":true},"inlayHint":{"dynamicRegistration":true,"resolveSupport":{"properties":["tooltip","textEdits","label.tooltip","label.location","label.command"]}},"inlineValue":{"dynamicRegistration":true},"linkedEditingRange":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"codeDescriptionSupport":true,"dataSupport":true,"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":false},"rangeFormatting":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"honorsChangeAnnotations":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1},"selectionRange":{"dynamicRegistration":true},"semanticTokens":{"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","operator","decorator"]},"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},"inlayHint":{"refreshSupport":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":true},"documentChanges":true,"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"Visual Studio Code","version":"1.93.1"},"initializationOptions":{"clangdFileStatus":true,"fallbackFlags":[]},"locale":"zh-cn","processId":7684,"rootPath":"c:\\Users\\24306\\Documents\\abc","rootUri":"file:///c%3A/Users/24306/Documents/abc","trace":"off","workspaceFolders":[{"name":"abc","uri":"file:///c%3A/Users/24306/Documents/abc"}]}}

I[10:55:21.194] <-- initialize(0)
I[10:55:21.197] --> reply:initialize(0) 2 ms
V[10:55:21.197] >>> {"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":"clangd version 18.1.7 (git://code.qt.io/clang/llvm-project.git 393c912b8e044eb2a86dd9336f4915525bbc051c) windows x86_64-w64-windows-gnu"}}}

V[10:55:21.198] <<< {"jsonrpc":"2.0","method":"initialized","params":{}}

I[10:55:21.198] <-- initialized
V[10:55:21.202] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"#include <iostream>\n\nint a;\n\nint main(int, char**)\n{\n    std::cout << \"Hello, from abc!\\n\";\n}\n","uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp","version":1}}}

I[10:55:21.202] <-- textDocument/didOpen
V[10:55:21.203] config note at C:/Users/24306/AppData/Local/clangd/config.yaml:2:0: Parsing config fragment
V[10:55:21.203] config note at C:/Users/24306/AppData/Local/clangd/config.yaml:1:0: Parsed 1 fragments from file
V[10:55:21.203] Config fragment: compiling C:/Users/24306/AppData/Local/clangd/config.yaml:2 -> 0x0000021DE7F9C280 (trusted=true)
I[10:55:21.203] --> textDocument/publishDiagnostics
V[10:55:21.203] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///C:/Users/24306/AppData/Local/clangd/config.yaml"}}

I[10:55:21.203] Loaded compilation database from c:/Users/24306/Documents/abc/build/compile_commands.json
V[10:55:21.203] Broadcasting compilation database from c:/Users/24306/Documents/abc
I[10:55:21.203] ASTWorker building file c:/Users/24306/Documents/abc/main.cpp version 1 with command 
[C:/Users/24306/Documents/abc/build]
C:/Qt/Tools/mingw1120_64/bin/c++.exe --driver-mode=g++ -g -o "CMakeFiles\\abc.dir\\main.cpp.obj" -c -resource-dir=C:/Qt/Tools/QtCreator/bin/clang/lib/clang/18 -- c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.204] --> window/workDoneProgress/create(0)
V[10:55:21.204] >>> {"id":0,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"backgroundIndexProgress"}}

I[10:55:21.204] Enqueueing 1 commands for indexing
V[10:55:21.204] <<< {"id":0,"jsonrpc":"2.0","result":null}

I[10:55:21.204] <-- reply(0)
I[10:55:21.204] --> $/progress
V[10:55:21.204] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"begin","percentage":0,"title":"indexing"}}}

I[10:55:21.204] --> $/progress
V[10:55:21.204] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/1","percentage":0}}}

V[10:55:21.204] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -fno-use-init-array -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=C:/Users/24306/Documents/abc/build -fcoverage-compilation-dir=C:/Users/24306/Documents/abc/build -resource-dir C:/Qt/Tools/QtCreator/bin/clang/lib/clang/18 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++ -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/backward -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/11.2.0 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/11.2.0/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/11.2.0/backward -internal-isystem C:/Qt/Tools/mingw1120_64/include/c++/11.2.0 -internal-isystem C:/Qt/Tools/mingw1120_64/include/c++/11.2.0/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/include/c++/11.2.0/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2.0 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2.0/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2.0/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11/backward -internal-isystem C:/Qt/Tools/QtCreator/bin/clang/lib/clang/18/include -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/usr/include -internal-isystem C:/Qt/Tools/mingw1120_64/include -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -exception-model=seh -no-round-trip-args -faddrsig -x c++ c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.204] --> textDocument/clangd.fileStatus
V[10:55:21.204] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Update","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.204] Building first preamble for c:/Users/24306/Documents/abc/main.cpp version 1
V[10:55:21.237] BackgroundIndex: building version 1 after loading index from disk
V[10:55:21.252] BackgroundIndex: serving version 1 (6272604 bytes)
I[10:55:21.263] --> $/progress
V[10:55:21.264] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/1","percentage":0}}}

I[10:55:21.264] --> $/progress
V[10:55:21.264] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}

I[10:55:21.361] Built preamble of size 3076032 for file c:/Users/24306/Documents/abc/main.cpp version 1 in 0.16 seconds
I[10:55:21.363] --> workspace/semanticTokens/refresh(1)
I[10:55:21.363] Indexing c++17 standard library in the context of c:/Users/24306/Documents/abc/main.cpp
V[10:55:21.363] >>> {"id":1,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}

I[10:55:21.363] --> textDocument/clangd.fileStatus
V[10:55:21.363] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Build AST","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

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

I[10:55:21.364] <-- reply(1)
V[10:55:21.371] <<< {"id":1,"jsonrpc":"2.0","method":"textDocument/documentLink","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.371] <-- textDocument/documentLink(1)
V[10:55:21.371] <<< {"id":2,"jsonrpc":"2.0","method":"textDocument/inlayHint","params":{"range":{"end":{"character":0,"line":8},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.371] <-- textDocument/inlayHint(2)
V[10:55:21.380] indexed file AST for c:/Users/24306/Documents/abc/main.cpp version 1:
  symbol slab: 2 symbols, 4680 bytes
  ref slab: 4 symbols, 4 refs, 4320 bytes
  relations slab: 0 relations, 24 bytes
V[10:55:21.380] Build dynamic index for main-file symbols with estimated memory usage of 12152 bytes
I[10:55:21.380] --> textDocument/publishDiagnostics
V[10:55:21.380] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///c:/Users/24306/Documents/abc/main.cpp","version":1}}

I[10:55:21.380] --> textDocument/inactiveRegions
V[10:55:21.380] >>> {"jsonrpc":"2.0","method":"textDocument/inactiveRegions","params":{"regions":[],"textDocument":{"uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}}

V[10:55:21.380] ASTWorker running DocumentLinks on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.380] --> reply:textDocument/documentLink(1) 9 ms
V[10:55:21.380] >>> {"id":1,"jsonrpc":"2.0","result":[{"range":{"end":{"character":19,"line":0},"start":{"character":9,"line":0}},"target":"file:///C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c%2B%2B/iostream"}]}

V[10:55:21.380] ASTWorker running InlayHints on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.380] --> reply:textDocument/inlayHint(2) 9 ms
V[10:55:21.380] >>> {"id":2,"jsonrpc":"2.0","result":[]}

I[10:55:21.380] --> textDocument/clangd.fileStatus
V[10:55:21.380] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.405] <<< {"id":3,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.405] <-- textDocument/semanticTokens/full(3)
V[10:55:21.405] ASTWorker running SemanticHighlights on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.405] --> reply:textDocument/semanticTokens/full(3) 0 ms
V[10:55:21.405] >>> {"id":3,"jsonrpc":"2.0","result":{"data":[2,4,1,0,131075,2,4,4,3,131075,2,4,3,15,131584,0,5,4,0,131584,0,5,2,21,8192],"resultId":"1"}}

I[10:55:21.405] --> textDocument/clangd.fileStatus
V[10:55:21.405] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.417] indexed preamble AST for c:/Users/24306/Documents/abc/main.cpp version 1:
  symbol slab: 5143 symbols, 1590608 bytes
  ref slab: 0 symbols, 0 refs, 128 bytes
  relations slab: 288 relations, 8728 bytes
V[10:55:21.436] Build dynamic index for header symbols with estimated memory usage of 3658172 bytes
V[10:55:21.591] <<< {"id":4,"jsonrpc":"2.0","method":"textDocument/foldingRange","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.591] <-- textDocument/foldingRange(4)
V[10:55:21.591] <<< {"id":5,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":4,"line":2},"start":{"character":4,"line":2}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.591] <-- textDocument/codeAction(5)
V[10:55:21.591] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.592] --> reply:textDocument/codeAction(5) 0 ms
V[10:55:21.592] >>> {"id":5,"jsonrpc":"2.0","result":[]}

I[10:55:21.592] --> textDocument/clangd.fileStatus
V[10:55:21.592] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

I[10:55:21.592] --> reply:textDocument/foldingRange(4) 1 ms
V[10:55:21.592] >>> {"id":4,"jsonrpc":"2.0","result":[{"endLine":6,"kind":"region","startCharacter":1,"startLine":5}]}

V[10:55:21.594] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[10:55:21.594] <-- $/setTrace
I[10:55:21.594] unhandled notification $/setTrace
V[10:55:21.615] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[10:55:21.615] <-- $/setTrace
I[10:55:21.616] unhandled notification $/setTrace
V[10:55:21.666] <<< {"id":6,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.666] <-- textDocument/documentSymbol(6)
V[10:55:21.666] ASTWorker running DocumentSymbols on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.666] --> reply:textDocument/documentSymbol(6) 0 ms
V[10:55:21.666] >>> {"id":6,"jsonrpc":"2.0","result":[{"detail":"int","kind":13,"name":"a","range":{"end":{"character":5,"line":2},"start":{"character":0,"line":2}},"selectionRange":{"end":{"character":5,"line":2},"start":{"character":4,"line":2}}},{"detail":"int (int, char **)","kind":12,"name":"main","range":{"end":{"character":1,"line":7},"start":{"character":0,"line":4}},"selectionRange":{"end":{"character":8,"line":4},"start":{"character":4,"line":4}}}]}

I[10:55:21.666] --> textDocument/clangd.fileStatus
V[10:55:21.666] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.791] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[10:55:21.791] <-- $/setTrace
I[10:55:21.791] unhandled notification $/setTrace
V[10:55:21.802] <<< {"id":7,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":4,"line":2},"start":{"character":4,"line":2}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.802] <-- textDocument/codeAction(7)
V[10:55:21.802] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.802] --> reply:textDocument/codeAction(7) 0 ms
V[10:55:21.802] >>> {"id":7,"jsonrpc":"2.0","result":[]}

I[10:55:21.802] --> textDocument/clangd.fileStatus
V[10:55:21.802] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.809] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":7}}

I[10:55:21.809] <-- $/cancelRequest
V[10:55:21.810] <<< {"id":8,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":4,"line":2},"start":{"character":4,"line":2}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.810] <-- textDocument/codeAction(8)
V[10:55:21.810] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.810] --> reply:textDocument/codeAction(8) 0 ms
V[10:55:21.810] >>> {"id":8,"jsonrpc":"2.0","result":[]}

I[10:55:21.810] --> textDocument/clangd.fileStatus
V[10:55:21.810] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.810] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[10:55:21.810] <-- $/setTrace
I[10:55:21.810] unhandled notification $/setTrace
V[10:55:21.811] <<< {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":8}}

I[10:55:21.811] <-- $/cancelRequest
V[10:55:21.811] <<< {"id":9,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":4,"line":2},"start":{"character":4,"line":2}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.811] <-- textDocument/codeAction(9)
V[10:55:21.811] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.811] --> reply:textDocument/codeAction(9) 0 ms
V[10:55:21.811] >>> {"id":9,"jsonrpc":"2.0","result":[]}

I[10:55:21.811] --> textDocument/clangd.fileStatus
V[10:55:21.811] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.813] <<< {"id":10,"jsonrpc":"2.0","method":"textDocument/documentLink","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:21.813] <-- textDocument/documentLink(10)
V[10:55:21.813] ASTWorker running DocumentLinks on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:21.813] --> reply:textDocument/documentLink(10) 0 ms
V[10:55:21.813] >>> {"id":10,"jsonrpc":"2.0","result":[{"range":{"end":{"character":19,"line":0},"start":{"character":9,"line":0}},"target":"file:///C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c%2B%2B/iostream"}]}

I[10:55:21.813] --> textDocument/clangd.fileStatus
V[10:55:21.813] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:21.879] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[10:55:21.879] <-- $/setTrace
I[10:55:21.879] unhandled notification $/setTrace
V[10:55:22.201] Ignored diagnostic. C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/coroutine:334:2:"the coroutine header requires -fcoroutines"
V[10:55:22.362] Ignored diagnostic. C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/experimental/bits/fs_path.h:621:31:invalid use of incomplete type 'filesystem_error'
V[10:55:22.362] Ignored diagnostic. C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/experimental/bits/fs_fwd.h:69:9:forward declaration of 'std::experimental::filesystem::filesystem_error'
V[10:55:22.362] Ignored diagnostic. C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/experimental/bits/fs_path.h:621:7:cannot throw object of incomplete type 'filesystem_error'
V[10:55:22.362] Ignored diagnostic. C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/experimental/bits/fs_fwd.h:69:9:forward declaration of 'std::experimental::filesystem::filesystem_error'
I[10:55:22.520] Indexed c++17 standard library (incomplete due to errors): 13051 symbols, 841 filtered
V[10:55:22.555] Build dynamic index for header symbols with estimated memory usage of 8346732 bytes
V[10:55:23.088] <<< {"id":11,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":4,"line":2},"start":{"character":4,"line":2}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:23.088] <-- textDocument/codeAction(11)
V[10:55:23.088] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:23.088] --> reply:textDocument/codeAction(11) 0 ms
V[10:55:23.088] >>> {"id":11,"jsonrpc":"2.0","result":[]}

I[10:55:23.088] --> textDocument/clangd.fileStatus
V[10:55:23.088] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:23.089] <<< {"id":12,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.cpp"}}}

I[10:55:23.089] <-- textDocument/documentSymbol(12)
V[10:55:23.089] ASTWorker running DocumentSymbols on version 1 of c:/Users/24306/Documents/abc/main.cpp
I[10:55:23.089] --> reply:textDocument/documentSymbol(12) 0 ms
V[10:55:23.090] >>> {"id":12,"jsonrpc":"2.0","result":[{"detail":"int","kind":13,"name":"a","range":{"end":{"character":5,"line":2},"start":{"character":0,"line":2}},"selectionRange":{"end":{"character":5,"line":2},"start":{"character":4,"line":2}}},{"detail":"int (int, char **)","kind":12,"name":"main","range":{"end":{"character":1,"line":7},"start":{"character":0,"line":4}},"selectionRange":{"end":{"character":8,"line":4},"start":{"character":4,"line":4}}}]}

I[10:55:23.090] --> textDocument/clangd.fileStatus
V[10:55:23.090] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.cpp"}}

V[10:55:23.103] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[10:55:23.103] <-- $/setTrace
I[10:55:23.103] unhandled notification $/setTrace
V[10:55:25.621] <<< {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"extern int a;\n","uri":"file:///c%3A/Users/24306/Documents/abc/main.h","version":1}}}

I[10:55:25.621] <-- textDocument/didOpen
I[10:55:25.621] ASTWorker building file c:/Users/24306/Documents/abc/main.h version 1 with command inferred from C:/Users/24306/Documents/abc/main.cpp
[C:/Users/24306/Documents/abc/build]
C:/Qt/Tools/mingw1120_64/bin/c++.exe --driver-mode=g++ -g -c -x c++-header -resource-dir=C:/Qt/Tools/QtCreator/bin/clang/lib/clang/18 -- c:/Users/24306/Documents/abc/main.h
V[10:55:25.622] Driver produced command: cc1 -cc1 -triple x86_64-w64-windows-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.h -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -fno-use-init-array -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=C:/Users/24306/Documents/abc/build -fcoverage-compilation-dir=C:/Users/24306/Documents/abc/build -resource-dir C:/Qt/Tools/QtCreator/bin/clang/lib/clang/18 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++ -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/backward -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/11.2.0 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/11.2.0/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/c++/11.2.0/backward -internal-isystem C:/Qt/Tools/mingw1120_64/include/c++/11.2.0 -internal-isystem C:/Qt/Tools/mingw1120_64/include/c++/11.2.0/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/include/c++/11.2.0/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2.0 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2.0/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2.0/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11.2/backward -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11/x86_64-w64-mingw32 -internal-isystem C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/g++-v11/backward -internal-isystem C:/Qt/Tools/QtCreator/bin/clang/lib/clang/18/include -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include -internal-isystem C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/usr/include -internal-isystem C:/Qt/Tools/mingw1120_64/include -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -exception-model=seh -no-round-trip-args -faddrsig -x c++-header c:/Users/24306/Documents/abc/main.h
I[10:55:25.622] --> textDocument/clangd.fileStatus
V[10:55:25.622] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"parsing includes, running Update","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.622] Building first preamble for c:/Users/24306/Documents/abc/main.h version 1
V[10:55:25.629] <<< {"id":13,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.629] <-- textDocument/codeAction(13)
V[10:55:25.629] <<< {"id":14,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.629] <-- textDocument/documentSymbol(14)
I[10:55:25.631] Built preamble of size 238280 for file c:/Users/24306/Documents/abc/main.h version 1 in 0.01 seconds
I[10:55:25.631] --> workspace/semanticTokens/refresh(2)
V[10:55:25.631] >>> {"id":2,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}

V[10:55:25.631] indexed preamble AST for c:/Users/24306/Documents/abc/main.h version 1:
  symbol slab: 0 symbols, 120 bytes
  ref slab: 0 symbols, 0 refs, 128 bytes
  relations slab: 0 relations, 24 bytes
V[10:55:25.633] <<< {"id":2,"jsonrpc":"2.0","result":null}

I[10:55:25.633] <-- reply(2)
V[10:55:25.644] indexed file AST for c:/Users/24306/Documents/abc/main.h version 1:
  symbol slab: 1 symbols, 4448 bytes
  ref slab: 1 symbols, 1 refs, 4248 bytes
  relations slab: 0 relations, 24 bytes
V[10:55:25.644] Build dynamic index for main-file symbols with estimated memory usage of 20880 bytes
I[10:55:25.644] --> textDocument/publishDiagnostics
V[10:55:25.644] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///c:/Users/24306/Documents/abc/main.h","version":1}}

I[10:55:25.644] --> textDocument/inactiveRegions
V[10:55:25.644] >>> {"jsonrpc":"2.0","method":"textDocument/inactiveRegions","params":{"regions":[],"textDocument":{"uri":"file:///c:/Users/24306/Documents/abc/main.h"}}}

V[10:55:25.644] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.644] --> reply:textDocument/codeAction(13) 14 ms
V[10:55:25.644] >>> {"id":13,"jsonrpc":"2.0","result":[]}

V[10:55:25.644] ASTWorker running DocumentSymbols on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.644] --> reply:textDocument/documentSymbol(14) 14 ms
V[10:55:25.644] >>> {"id":14,"jsonrpc":"2.0","result":[{"detail":"int","kind":13,"name":"a","range":{"end":{"character":12,"line":0},"start":{"character":0,"line":0}},"selectionRange":{"end":{"character":12,"line":0},"start":{"character":11,"line":0}}}]}

I[10:55:25.644] --> textDocument/clangd.fileStatus
V[10:55:25.644] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.646] <<< {"id":15,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.646] <-- textDocument/semanticTokens/full(15)
V[10:55:25.646] ASTWorker running SemanticHighlights on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.647] --> reply:textDocument/semanticTokens/full(15) 0 ms
V[10:55:25.647] >>> {"id":15,"jsonrpc":"2.0","result":{"data":[0,11,1,0,131073],"resultId":"1"}}

I[10:55:25.647] --> textDocument/clangd.fileStatus
V[10:55:25.647] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.654] <<< {"id":16,"jsonrpc":"2.0","method":"textDocument/documentLink","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.654] <-- textDocument/documentLink(16)
V[10:55:25.654] ASTWorker running DocumentLinks on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.654] --> reply:textDocument/documentLink(16) 0 ms
V[10:55:25.654] >>> {"id":16,"jsonrpc":"2.0","result":[]}

I[10:55:25.654] --> textDocument/clangd.fileStatus
V[10:55:25.654] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.658] <<< {"id":17,"jsonrpc":"2.0","method":"textDocument/inlayHint","params":{"range":{"end":{"character":0,"line":1},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.659] <-- textDocument/inlayHint(17)
V[10:55:25.659] ASTWorker running InlayHints on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.659] --> reply:textDocument/inlayHint(17) 0 ms
V[10:55:25.659] >>> {"id":17,"jsonrpc":"2.0","result":[]}

I[10:55:25.659] --> textDocument/clangd.fileStatus
V[10:55:25.659] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.827] <<< {"id":18,"jsonrpc":"2.0","method":"textDocument/foldingRange","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.827] <-- textDocument/foldingRange(18)
I[10:55:25.828] --> reply:textDocument/foldingRange(18) 0 ms
V[10:55:25.828] >>> {"id":18,"jsonrpc":"2.0","result":[]}

V[10:55:25.887] <<< {"id":19,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":11,"line":0},"start":{"character":11,"line":0}},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.887] <-- textDocument/codeAction(19)
V[10:55:25.887] ASTWorker running codeAction on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.887] --> reply:textDocument/codeAction(19) 0 ms
V[10:55:25.887] >>> {"id":19,"jsonrpc":"2.0","result":[]}

I[10:55:25.887] --> textDocument/clangd.fileStatus
V[10:55:25.887] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.932] <<< {"id":20,"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.932] <-- textDocument/documentSymbol(20)
V[10:55:25.932] ASTWorker running DocumentSymbols on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.933] --> reply:textDocument/documentSymbol(20) 0 ms
V[10:55:25.933] >>> {"id":20,"jsonrpc":"2.0","result":[{"detail":"int","kind":13,"name":"a","range":{"end":{"character":12,"line":0},"start":{"character":0,"line":0}},"selectionRange":{"end":{"character":12,"line":0},"start":{"character":11,"line":0}}}]}

I[10:55:25.933] --> textDocument/clangd.fileStatus
V[10:55:25.933] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:25.970] <<< {"id":21,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full/delta","params":{"previousResultId":"1","textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:25.970] <-- textDocument/semanticTokens/full/delta(21)
V[10:55:25.970] ASTWorker running SemanticHighlights on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:25.970] --> reply:textDocument/semanticTokens/full/delta(21) 0 ms
V[10:55:25.970] >>> {"id":21,"jsonrpc":"2.0","result":{"edits":[],"resultId":"2"}}

I[10:55:25.970] --> textDocument/clangd.fileStatus
V[10:55:25.970] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:27.052] <<< {"id":22,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":11,"line":0},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:27.052] <-- textDocument/hover(22)
V[10:55:27.053] ASTWorker running Hover on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:27.054] --> reply:textDocument/hover(22) 1 ms
V[10:55:27.054] >>> {"id":22,"jsonrpc":"2.0","result":{"contents":{"kind":"markdown","value":"### variable `a`  \n\n---\nType: `int`  \n\n---\n```cpp\nextern int a\n```"},"range":{"end":{"character":12,"line":0},"start":{"character":11,"line":0}}}}

I[10:55:27.054] --> textDocument/clangd.fileStatus
V[10:55:27.054] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:27.966] <<< {"id":23,"jsonrpc":"2.0","method":"textDocument/prepareRename","params":{"position":{"character":11,"line":0},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:27.966] <-- textDocument/prepareRename(23)
V[10:55:27.966] ASTWorker running PrepareRename on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:27.967] --> reply:textDocument/prepareRename(23) 0 ms
V[10:55:27.967] >>> {"id":23,"jsonrpc":"2.0","result":{"end":{"character":12,"line":0},"start":{"character":11,"line":0}}}

I[10:55:27.967] --> textDocument/clangd.fileStatus
V[10:55:27.967] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}

V[10:55:30.487] <<< {"id":24,"jsonrpc":"2.0","method":"textDocument/rename","params":{"newName":"a1","position":{"character":11,"line":0},"textDocument":{"uri":"file:///c%3A/Users/24306/Documents/abc/main.h"}}}

I[10:55:30.487] <-- textDocument/rename(24)
V[10:55:30.487] ASTWorker running Rename on version 1 of c:/Users/24306/Documents/abc/main.h
I[10:55:30.488] --> reply:textDocument/rename(24) 0 ms
V[10:55:30.488] >>> {"id":24,"jsonrpc":"2.0","result":{"changes":{"file:///C:/Users/24306/Documents/abc/main.cpp":[{"newText":"a1","range":{"end":{"character":5,"line":2},"start":{"character":4,"line":2}}}],"file:///c:/Users/24306/Documents/abc/main.cpp":[{"newText":"a1","range":{"end":{"character":5,"line":2},"start":{"character":4,"line":2}}}],"file:///c:/Users/24306/Documents/abc/main.h":[{"newText":"a1","range":{"end":{"character":12,"line":0},"start":{"character":11,"line":0}}}]}}}

I[10:55:30.488] --> textDocument/clangd.fileStatus
V[10:55:30.488] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///c:/Users/24306/Documents/abc/main.h"}}
HighCommander4 commented 13 hours ago

What I'm seeing in the log, is that vscode is sending a lowercase c: in the path in the textDocument/didOpen command. But the compile_commands.json file uses uppercase C:.

Since you probably can't control what vscode sends, I would try changing the compile_commands.json to contain lowercase c:'s instead.

luo2430 commented 11 hours ago

What I'm seeing in the log, is that vscode is sending a lowercase c: in the path in the textDocument/didOpen command. But the compile_commands.json file uses uppercase C:.

Since you probably can't control what vscode sends, I would try changing the compile_commands.json to contain lowercase c:'s instead.

@HighCommander4 I have a try, it does work, but whenever I use cmake to build a project, it will refresh the compile_commands.json. So maybe it's not the best solution.