microsoft / microsoft/vscode-cpptools

Default clang-format is bundled version not system version

Open
#6,294 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Feature: Code Formatting help wanted Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: LanguageService

Describe the bug

  • OS and Version: Ubuntu 18.-4
  • VS Code Version: 1.50.0
  • C/C++ Extension Version: 1.01
  • Other extensions you installed (and if the issue persists after disabling them):
  • Does this issue involve using SSH remote to run the extension on a remote machine?: NA
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

When using clang-format to format a document with no path set for the field "C_Cpp.clang_format_path" the bundled version is used instead of the system version.

"The full path of the clang-format executable. If not specified, and clang-format is available in the environment path, that is used. If not found in the environment path, a copy of clang-format bundled with the extension will be used."

The only way I can tell this is clang-format-10 reorders groups by default where clang-format-6(18.04 ubuntu default) preserves the group by default. This is checked by specify the path to clang-format and observing the changes.

~/.vscode/extensions/ms-vscode.cpptools-1.0.1/LLVM/bin/clang-format --version
clang-format version 10.0.0 (https://github.com/llvm/llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28)
clang-format --version
clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the C_Cpp.clang_format_path setting and trace how the extension resolves clang-format when the setting is unset, comparing the bundled LLVM/bin/clang-format with the system executable. Done means the documented environment-path preference is honored and the behavior is verified against the reported clang-format versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.