VSCode,Intellisense C ++自动完成功能不起作用,Ubuntu 20.04

时间:2020-09-15 08:07:04

标签: visual-studio-code intellisense vscode-settings 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市场上的所有必要扩展。 Installed extensions

我遵循了在link这里settings.json进行配置的步骤

最后,我的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,
}

我想不出自动完成现在无法正常工作的原因。请查看您是否发现错误。如果需要更多信息,请在评论中告诉我。

谢谢

1 个答案:

答案 0 :(得分:0)

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

enter image description here