Skip to content

[clangd]: what if the software is built in a docker? #464

Closed Answered by ubaldot
ubaldot asked this question in Q&A
Discussion options

You must be logged in to vote

I can self-answer myself.

Create a script like the following:

#!/usr/bin/env bash

set -o errexit
set -o nounset


image=my_image:local
timestamp=$(date '+%y%m%d_%H%M%S')
container_name=$(echo ${image} | sed 's/\:/\./g')

clangd_options="--log=verbose --background-index -header-insertion=never"
clangd_mappings="--path-mappings=/home/myname/proj_example=/app,/home/myname=/host_home"

# enter container
docker run --name "${container_name}_${timestamp}" -h $(hostname)-docker -i -e HOST_USER_ID=$(id -u) -e HOST_USER_GID=$(id -g) -v $HOME:/host_home -v "$PWD":/app   -e USER_ADDED_ENV="${USER_ADDED_ENV:-}" -w /app "$image" clangd "$clangd_mappings" "$clangd_options"

Needless to say that such a…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ubaldot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant