Skip to content

Clang-format command wrong syntax #12819

Closed
Closed
@prototact

Description

@prototact

Environment

  • OS and Version: Linux x64 6.10.12-200.fc40.x86_64
  • VS Code Version: 1.94.0
  • C/C++ Extension Version: 1.22.7 (pre-release)
  • If using SSH remote, specify OS of remote machine: Ubuntu 22.04

Bug Summary and Steps to Reproduce

Bug Summary:
The command options to clang-format have bad syntax (one hyphen instead of two) when run by vscode on each save.

Steps to reproduce:

  1. Save file with clang-format
  2. Output is
    Formatting failed: clang-format -style=file:/{path}/.clang-format -fallback-style=LLVM --Wno-error=unknown -assume-filename={filepath} {filepath}

Expected behavior:
Normally the file would be formatted

Configuration and Logs

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${default}",
                "../build/**",
                "../src/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "intelliSenseMode": "linux-clang-x64"
        }
    ],
    "version": 4
}

-------- Diagnostics - 10/8/2024, 1:07:17 PM
Version: 1.22.7
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/ns3/ns-3-dev/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "intelliSenseMode": "linux-clang-x64",
    "compilerPathInCppPropertiesJson": "/usr/bin/clang",
    "cppStandard": "c++20",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "/home/ns3/ns-3-dev/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.cppStandard": "c++20",
    "C_Cpp.clang_format_path": "clang-format",
    "C_Cpp.clang_format_style": "file:/home/ns3/ns-3-dev/.clang-format",
    "C_Cpp.formatting": "clangFormat",
    "C_Cpp.clang_format_fallbackStyle": "",
    "C_Cpp.codeAnalysis.clangTidy.enabled": true,
    "C_Cpp.codeAnalysis.clangTidy.config": "/home/ns3/ns-3-dev/.clang-tidy /home/ns3/ns-3-dev/contrib/nr/.clang-tidy",
    "C_Cpp.updateChannel": "Insiders"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.7.0
Current database path: /home/ns3/.cache/vscode-cpptools/08916d960f07b7c21f876f6c779639b5/.browse.VC.db
rk/CMakeFiles/libnetwork-obj.dir/helper
...
    System Includes:
        /usr/include/c++/11
        /usr/include/x86_64-linux-gnu/c++/11
        /usr/include/c++/11/backward
        /usr/lib/llvm-14/lib/clang/14.0.0/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++20
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=140000
Total Memory Usage: 741 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 36794
Number of files parsed: 8378

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions