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

clang-format extension does not work #390

Open
Digitalone1 opened this issue Dec 3, 2024 · 1 comment
Open

clang-format extension does not work #390

Digitalone1 opened this issue Dec 3, 2024 · 1 comment
Assignees

Comments

@Digitalone1
Copy link

I installed clang-format extension to format C++ files. It basically should call the clang-format executable in /usr/bin/clang-format, but it does not work inside Flatpak VSCodium.

It should be something related to the sandbox, but I can't get a workaround. I'd like to use the Flatpak version, but maybe the only fix is to return back to the normal one?

@noonsleeper noonsleeper self-assigned this Dec 3, 2024
@noonsleeper
Copy link
Collaborator

noonsleeper commented Dec 3, 2024

@Digitalone1 /usr/bin directory is protected by flatpak, you can do a workaround by creating a wrapper for clang-format binary on your host like

#!/usr/bin/env bash

# uncomment this line if you prefered flatpak-spawn instead of host-spawn
# flatpak-spawn --host "/HOST/PATH/TO/clang-format" "${@}"
host-spawn "/HOST/PATH/TO/clang-format" "${@}"

exit 0

Put these on your home for example ~/.local/bin/clang-format (make sure that the wrapper is executable with a chmod +x), I have in my zshrc/bashrc a modifed PATH variable like this:

### User specific environment
if ! [[ "${PATH}" =~ ${HOME}/.local/bin: ]]
then
    PATH="${HOME}/.local/bin:${PATH}"
fi
export PATH

And add the wrapper whenever the plugin ask for clang-format binary.

It is not the best, but does the trick.

The better will be that someone add support for clang on an extension like org.freedesktop.Sdk.Extension.clang-stable.

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

2 participants