Repository navigation
In large-scale C/C+projects, the GB2312 encoding format will affect intelligent perception #13028
Copy link
Copy link
Closed
Closed
Copy link
Labels
Feature: ColorizationLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous releaseA bug that didn't exist in a previous releaseworld readyAn issue relating string character encodings, localization translations, etc.An issue relating string character encodings, localization translations, etc.
Milestone
Description
Environment
- OS and Version: windows 10
- VS Code Version: 1.95.3
- C/C++ Extension Version: 1.12.6
- If using SSH remote, specify OS of remote machine: Ubuntu 18.04.5 LTS
Bug Summary and Steps to Reproduce
I found that in my large C/C++project, all annotations containing Chinese (GB2312) can affect intelligent perception, and the color rendering of the code is also incorrect. At this time, my setting is "files. encoding": "gb2312"
After deleting "files. encoding": "gb2312" and "files. autoGuessEncoding": true, it looks a bit normal now, but the intelligent perception is still not good
For example, when jumping to a function, it can only jump to the. h file. However, when I modified the corresponding. c file to convert it to UTF-8 format, it worked properly
I am confused whether this is a problem with vscode or cpptools
Configuration and Logs
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/opt/rv1106-rockit/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
{
"os": "linux",
"vscodeVersion": "1.95.3",
"cmtVersion": "1.19.52",
"configurations": [
{
"folder": "/home/caixiangbo/work/ipc_new",
"cmakeVersion": "3.27.6",
"configured": true,
"generator": "Unix Makefiles",
"usesPresets": false,
"compilers": {
"C": "/opt/rv1126-rockit/arm-rockchip830-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc",
"CXX": "/opt/rv1126-rockit/arm-rockchip830-linux-gnueabihf/bin/arm-linux-gnueabihf-g++"
}
},
{
"folder": "/home/caixiangbo/work/APP_4G",
"cmakeVersion": "3.27.6",
"configured": true,
"generator": "Unix Makefiles",
"usesPresets": false,
"compilers": {
"C": "/opt/rv1106-rockit/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc",
"CXX": "/opt/rv1106-rockit/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-g++"
}
},
{
"folder": "/home/caixiangbo/work/protocol",
"cmakeVersion": "unknown",
"configured": false,
"generator": "unknown",
"usesPresets": false,
"compilers": {}
},
{
"folder": "/home/caixiangbo/work/test_project",
"cmakeVersion": "unknown",
"configured": false,
"generator": "unknown",
"usesPresets": false,
"compilers": {}
},
{
"folder": "/home/caixiangbo/progs",
"cmakeVersion": "unknown",
"configured": false,
"generator": "unknown",
"usesPresets": false,
"compilers": {}
},
{
"folder": "/home/caixiangbo/opensource",
"cmakeVersion": "unknown",
"configured": false,
"generator": "unknown",
"usesPresets": false,
"compilers": {}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "RelWithDebInfo",
"buildTypesSeen": [
"RelWithDebInfo"
],
"requests": [
"file:///home/caixiangbo/work/ipc_new/module/src/mmhp_public.c"
],
"responses": [],
"partialMatches": [],
"targetCount": 25,
"executablesCount": 3,
"librariesCount": 22,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
The following log shows that I go to the "p_com_is_enet_channelid" interface, but did not successfully redirect and only displayed a few locations where this interface was called
LSP: (received) textDocument/definition: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 344)
LSP: (invoked) textDocument/definition: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 344)
LSP: Sending response (id: 344)
LSP: (received) cpptools/didChangeActiveEditor: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeActiveEditor: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) textDocument/documentHighlight: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 345)
LSP: (invoked) textDocument/documentHighlight: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 345)
LSP: Sending response (id: 345)
LSP: (received) textDocument/definition: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 346)
LSP: (invoked) textDocument/definition: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 346)
LSP: Sending response (id: 346)
LSP: (received) cpptools/getCodeActions: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 347)
LSP: (invoked) cpptools/getCodeActions: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 347)
LSP: Sending response (id: 347)
LSP: (received) cpptools/findAllReferences: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 348)
LSP: (invoked) cpptools/findAllReferences: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 348)
LSP: Sending response (id: 348)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) textDocument/documentHighlight: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 349)
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (invoked) textDocument/documentHighlight: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 349)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 349)
LSP: (received) cpptools/getCodeActions: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 350)
LSP: (received) cpptools/getFoldingRanges: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 351)
LSP: (received) cpptools/getDocumentSymbols: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 352)
LSP: (invoked) cpptools/getDocumentSymbols: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 352)
LSP: Sending response (id: 352)
LSP: (invoked) cpptools/getCodeActions: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 350)
LSP: Sending response (id: 350)
LSP: (invoked) cpptools/getFoldingRanges: file:///home/caixiangbo/work/ipc_new/module/src/mmhp_powerboard.c (id: 351)
LSP: Sending response (id: 351)Other Extensions
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Feature: ColorizationLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous releaseA bug that didn't exist in a previous releaseworld readyAn issue relating string character encodings, localization translations, etc.An issue relating string character encodings, localization translations, etc.
Type
Projects
- StatusShow more project fieldsDone
Activity
Colengms commentedon Dec 6, 2024
Hi Dr.bo (@Xboooo) . Do you also see the problem with the latest insiders, 1.23.2 ?
Note that
autoGuessEncodingis not supported by the C/C++ Extension when reading header files that are not open in the editor. #4753 I believe in order for gb2312 encoded files to be read correctly as headers, you would need to set "files.encoding": "gb2312". However, it's possible that might conflict with other non-gb2312 files. #11407 (comment)sean-mcmanus commentedon Dec 6, 2024
Minimal repro is with
"files.encoding": "gb2312",and files of that encoding (Change File Encoding command "Save With Encoding").test1.cpp
test1.h
int 这;The errors go away after the header is opened.
I repro it in 1.18.5 from a year ago so it doesn't appear to be a regression.
Xboooo commentedon Dec 9, 2024
Sean McManus (@sean-mcmanus) I see that you can reproduce this problem. Is there anything I can help with? I'm happy to help you solve this problem
sean-mcmanus commentedon Dec 10, 2024
Dr.bo (@Xboooo) The fix will be available in our next release, but due to the holidays I don't think we're releasing another update until January unless there's a severe enough regression bug.
Xboooo commentedon Dec 10, 2024
Sean McManus (@sean-mcmanus) Merry Christmas🎉! Enjoy your vacation to the fullest, I have returned the version to "v1.16.3" which can now avoid this defect
sean-mcmanus commentedon Jan 10, 2025
Dr.bo (@Xboooo) Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.23.3 (pre-release).
Xboooo commentedon Jan 12, 2025
Sean McManus (@sean-mcmanus) I tried the pre-release version v1.12.3, and it seems to have been fully fixed
heartacker commentedon Jan 12, 2025
great
Yingzi1234 commentedon Jan 27, 2025
Sean McManus (@sean-mcmanus) This issue has been fixed on latest C/C++ version 1.23.4(pre-release), you can get the details below. Thank you!