Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection of clang-format version fails in SSH remote session when clang-format is a symlink #12298

Open
saierd opened this issue May 13, 2024 · 0 comments

Comments

@saierd
Copy link

saierd commented May 13, 2024

Environment

  • OS and Version: Ubuntu 22.04
  • VS Code Version: 1.88.0
  • C/C++ Extension Version: 1.20.5
  • If using SSH remote, specify OS of remote machine: Ubuntu 20.04

Bug Summary and Steps to Reproduce

Bug Summary:

This is a follow-up to #10102 (comment)

As described in the comment history there, detection of the clang-format version sometimes seems to fail and as a result an old version of clang-format gets passed --Wno-error=unknown, which it does not support.

I could find the following conditions for this to happen:

  • The specified C_Cpp.clang_format_path points to a symlink. Replacing this path with the real path to the clang-format binary fixes the problem.
  • VS Code is connected remotely via SSH. The same settings work when using VS Code directly on the same machine.

Configuration and Logs

C_Cpp.clang_format_path is set to clang-format-8. It resolves to /usr/bin/clang-format-8, which is a symlink to ../lib/llvm-8/bin/clang-format.

C/C++ Log on Debug Level:

Formatting document: file://<file>
Formatting Engine: clangFormat
Formatting failed:
clang-format-8 -style=file -fallback-style=LLVM --Wno-error=unknown -assume-filename=<file> <file>

I could not find any logging for where the version detection happens.

clang-format-8 --version prints

clang-format version 8.0.1-9 (tags/RELEASE_801/final)

Other Extensions

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant