Skip to content

C_Cpp.clang_format_path won't accept environment variable #2344

@benlindsay

Description

@benlindsay

Type: LanguageService

Describe the bug

  • OS and Version: Mac OSX 10.12.6
  • VS Code Version: 1.25.1
  • C/C++ Extension Version: 0.17.7
  • A clear and concise description of what the bug is.

I have my clang-format in a custom path, specifically $HOME/.local/bin/clang-format. I have this on two different computers, both of which I use to edit some code via sshfs. I want to be able to specify something like this in my user settings:

{
    "C_Cpp.clang_format_path": "${env:HOME}/.local/bin/clang-format",
}

so that I get the same formatting functionality on both computers. Formatting works fine if I put in the absolute path with no variables, but all my attempts to use a variable have disabled the formatting functionality. I've tried "${env:HOME}/.local/bin/clang-format", "${env.HOME}/.local/bin/clang-format", "~/.local/bin/clang-format", and "$HOME/.local/bin/clang-format", all with no success. After any of these attempts if I replace the path with the absolute path it immediately works again.

Is there a way to use a variable here, or some other way to fix my problem?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.quick fix

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions