VSCode,Intellisense C++ 自动完成功能不工作,ubuntu 20.04

VSCode, Intellisense C++ Autocomplete not working, ubuntu 20.04

我已经在 ubuntu 20.04 下安装了 Vscode。如果没有智能感知自动完成,我就无法编码。但它不起作用。我在之前的 ubuntu LTS(16.04 , 18.04) 中使用过自动完成,没问题。

我已配置c_cpp_properties.json

    {
    "configurations": [
        {
            "name": "Linux",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/include/x86_64-linux-gnu/qt5",
                    "/usr/include/pcl",
                    "/usr/include",
                    "/usr/lib",
                    "/usr/share"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "/home/atas/colcon_ws/src/ROS_CB/chiconybot_ui/include/",
                "/home/atas/colcon_ws/build/chiconybot_ui/",
                "/usr/include/opencv4/",
                "/opt/ros/foxy/include/",
                "/usr/include/",
                "/usr/include/x86_64-linux-gnu/qt5/"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

正确找到头文件。我还从 VSCode 市场安装了所有必要的扩展。

我按照此处配置 settings.json 的步骤link

终于,我的settings.json长成了这样;

{
    "files.associations": {
        "cctype": "cpp",
        "cmath": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "atomic": "cpp",
        "strstream": "cpp",
        "chrono": "cpp",
        "cstdint": "cpp",
        "initializer_list": "cpp",
        "iosfwd": "cpp",
        "mutex": "cpp",
        "ratio": "cpp",
        "system_error": "cpp",
        "thread": "cpp",
        "cinttypes": "cpp",
        "typeindex": "cpp",
        "deque": "cpp",
        "vector": "cpp",
        "array": "cpp",
        "*.tcc": "cpp",
        "bitset": "cpp",
        "clocale": "cpp",
        "complex": "cpp",
        "condition_variable": "cpp",
        "list": "cpp",
        "unordered_map": "cpp",
        "exception": "cpp",
        "fstream": "cpp",
        "functional": "cpp",
        "iomanip": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "memory": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "numeric": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "type_traits": "cpp",
        "tuple": "cpp",
        "typeinfo": "cpp",
        "utility": "cpp",
        "valarray": "cpp",
        "*.ipp": "cpp",
        "codecvt": "cpp",
        "future": "cpp",
        "hash_map": "cpp",
        "hash_set": "cpp",
        "core": "cpp",
        "dense": "cpp",
        "numericaldiff": "cpp",
        "unordered_set": "cpp",
        "algorithm": "cpp",
        "cfenv": "cpp",
        "random": "cpp",
        "optional": "cpp",
        "string_view": "cpp",
        "iterator": "cpp",
        "map": "cpp",
        "memory_resource": "cpp",
        "set": "cpp",
        "string": "cpp",
        "slist": "cpp",
        "shared_mutex": "cpp",
        "forward_list": "cpp",
        "qvboxlayout": "cpp",
        "qstringlist": "cpp",
        "qspinbox": "cpp",
        "qstatusbar": "cpp",
        "qpushbutton": "cpp",
        "qcombobox": "cpp",
        "qgraphicsopacityeffect": "cpp",
        "qmovie": "cpp",
        "qtimer": "cpp",
        "qpainter": "cpp",
        "qwidget": "cpp",
        "qtwidgets": "cpp",
        "regex": "cpp",
        "qhostaddress": "cpp",
        "qaction": "cpp",
        "qlayout": "cpp",
        "qframe": "cpp",
        "qlayoutitem": "cpp",
        "qsize": "cpp",
        "qset": "cpp"
    },
    "editor.formatOnSave": true,
    "python.pythonPath": "/usr/bin/python3",
    "git.ignoreLimitWarning": true,
    // Controls if quick suggestions should show up while typing
    "editor.quickSuggestions": {
        "other": true,
        "comments": false,
        "strings": false
    },
    // Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.
    "editor.acceptSuggestionOnCommitCharacter": true,
    // Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change
    "editor.acceptSuggestionOnEnter": "on",
    // Controls the delay in ms after which quick suggestions will show up.
    "editor.quickSuggestionsDelay": 10,
    // Controls if suggestions should automatically show up when typing trigger characters
    "editor.suggestOnTriggerCharacters": true,
    // Controls if pressing tab inserts the best suggestion and if tab cycles through other suggestions
    "editor.tabCompletion": "on",
    // Controls whether sorting favours words that appear close to the cursor
    "editor.suggest.localityBonus": true,
    // Controls how suggestions are pre-selected when showing the suggest list
    "editor.suggestSelection": "recentlyUsed",
    // Enable word based suggestions
    "editor.wordBasedSuggestions": true,
    // Enable parameter hints
    "editor.parameterHints.enabled": true,
    "cmake.configureOnOpen": false,
}

我想不出自动完成功能现在不起作用的原因。请看看你是否发现错误。如果需要更多信息,请在评论中告诉我。

谢谢

事实证明,一些问题与 VSCode 本身有关。我检查了 help -> Check for Updates 上的新更新,新更新后一切恢复正常。当前可用的版本是 ;