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

Ensure clangd is executed in vscode.workspace.rootPath #153

Merged
merged 5 commits into from
Feb 23, 2021

Conversation

allight
Copy link
Contributor

@allight allight commented Feb 20, 2021

If the rootPath of a project is a symlink vscode can execute clangd in
the users home-directory. This can cause problems if one is, for
example, using a wrapper script which relies on knowing the current
project. This solves this issue by forcing the clangd to execute in
vscode.workspace.rootPath if available.

Test: manual

If the rootPath of a project is a symlink vscode can execute clangd in
the users home-directory. This can cause problems if one is, for
example, using a wrapper script which relies on knowing the current
project. This solves this issue by forcing the clangd to execute in
`vscode.workspace.rootPath` if available.

Test: manual
@allight
Copy link
Contributor Author

allight commented Feb 20, 2021

Just for background this is an issue I personally ran into since my job has a highly patched version of clangd in the path which breaks on some of the projects I work on. To work around this I have a script that looks at the current project and execs the appropriate clangd set as the global clangd.path. It uses the PWD to decide which clangd to use so this weird behavior with vscode not wanting to chdir into a symlink bit me by causing the wrapper to get confused since it was being run in $HOME.

Copy link
Member

@sam-mccall sam-mccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

src/clangd-context.ts Outdated Show resolved Hide resolved
@sam-mccall sam-mccall merged commit a9653a8 into clangd:master Feb 23, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants