Skip to content

In large-scale C/C+projects, the GB2312 encoding format will affect intelligent perception #13028

@Xboooo

Description

@Xboooo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: ColorizationLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous releaseworld readyAn issue relating string character encodings, localization translations, etc.

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions