Open CnsMaple opened 3 months ago
Please post clangd logs as instructed in the issue template.
Also, please share reproducing code in text form.
@HighCommander4
This is a repeated operation video:
https://github.com/clangd/vscode-clangd/assets/92523839/5fc554ce-4e97-434d-b0b7-657cda1417bb
This is the minimal source code: src.zip
This is a log: log.txt
The same code has no problem in Linux. This log is the log after all the operations in the video.
So is the issue with "go to definition", or "find references"?
(It's not clear to me because the issue's title mentions "go to definition" but the video is showing "find references" dialogs. Quite possibly in the video you are also performing "go to definition" but using a keyboard shortcut so it's harder to tell when it's happening.)
It helps if you specify:
So is the issue with "go to definition", or "find references"?
This title is the naming of my operation, maybe the actual problem is find references.
in which file you are performing the operation, at which location:
This is irrelevant, any variable that appears more than 2 times is like this.
which operation (go-to-def or find-refs):
Sorry, it's a matter of my usage habits, because go to definition will automatically include all situations, so I usually call go to definition directly, but which situation is included mainly depends on the title of the preview window. The current title is What is shown is a reference, but I performed the operation of going to the definition.
what results you're expecting:
The comment text variable should not be included, and the included comment text variable is misplaced.
what results you're getting:
Variables will still be jumped after being commented.
It is worth noting that newly written code will not have this problem.After restarting vscode, do not change the code, just comment and then go to the definition to appear.
I tried many configurations, and the same thing happened without any configuration.Until I discovered that when I was developing Qt in Linux, I found that there was no such problem in Linux.
I have suspected that the index has expired. Just restarting the language server can refresh and go to the definition.
"clangd.arguments": [
"--compile-commands-dir=build",
"--all-scopes-completion",
"--background-index",
"--background-index-priority=background",
"--clang-tidy",
"--completion-style=bundled",
"--fallback-style=WebKit",
"--header-insertion=iwyu",
"--header-insertion-decorators",
"-j=16",
"--pch-storage=memory",
"--log=verbose",
"--pretty",
],
I think this is not a clangd problem, it may be a vscode or vscode-clangd problem, because I have no problem using neovim's clangd in Windows.At present, I only found it in the qt project, not ordinary code. And I discovered this problem a year ago.
Please describe the problem. For hints on what information is helpful, see: https://clangd.llvm.org/troubleshooting.html
If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).
Logs Please attach the clangd log from the "Output" window if you can. If possible, run with
--log=verbose
- note that the logs will include the contents of open files!System information Clangd version (from the log, or
clangd --version
):17.0.3
clangd extension version: Operating system:There is no problem with the same project on Linux. The smallest reproducible project is to create a qt project, then comment a variable, and then use go to definition. In the first one in the list, it is not updated and still shows the commented variable.![Clip_2024-03-23_10-54-33](https://github.com/clangd/vscode-clangd/assets/92523839/070c6098-17bf-446c-9b4c-aeccef48bc0b)