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

Extension can't be used in with VSCode Workspaces #3

Closed
samopolacek opened this issue Apr 26, 2024 · 7 comments
Closed

Extension can't be used in with VSCode Workspaces #3

samopolacek opened this issue Apr 26, 2024 · 7 comments
Assignees

Comments

@samopolacek
Copy link

The path to compile_commands,json, in case of a VSCode Workspace, is usually relative to ${fileWorkspaceFoler}, which is not supported by the extension.

@helly25
Copy link
Owner

helly25 commented Jul 7, 2024

You need to set: iwyu.compile_commands in your VSCode user or workspace settings (see https://github.com/helly25/vscode-iwyu/?tab=readme-ov-file#extension-settings). This was unfortunately documented wrong in the README.

You can set it like this:

{
    "iwyu.compile_commands": "${workspaceFolder}/compile_commands.json"
}

Note that ${workspaceFolder}/compile_commands.json is actually the default.

@helly25 helly25 mentioned this issue Jul 7, 2024
@helly25 helly25 self-assigned this Jul 7, 2024
helly25 added a commit that referenced this issue Jul 7, 2024
Fix README for `iwyu.compile_commands` (as opposed to wrongly stated `iwyu.compile_commands.json`) (#9)

This should help with bugs like: #3
@helly25
Copy link
Owner

helly25 commented Jul 7, 2024

The reason you would still want ${fileWorkspaceFoler} over ${workspaceFoler} is that you are in a very rare case of multi-root-workspace. In all other case you can use the default of ${workspaceFoler}. If you are using CMake or other build-tool that places compile_commands.json under build, then for now you can just change the default in your settings as described in my earlier response.

Let me know if you are in a multi-root-workspace case.

@helly25
Copy link
Owner

helly25 commented Jul 7, 2024

This could maybe work. A rudimentary attempt is implemented in the current state of #10. Could you check if that works for you?

@helly25
Copy link
Owner

helly25 commented Jul 7, 2024

I extracted just the multi-root-workspace work into #12.

@helly25
Copy link
Owner

helly25 commented Jul 8, 2024

@samopolacek: The rudimentary multi-root-workspace support was just published as 0.1.16. Let me know how that works for you. If you find it lacking please reopen the issue.

@helly25 helly25 closed this as completed Jul 8, 2024
@samopolacek
Copy link
Author

@helly25 Yes, I am in a multi root workspace, hence I used fileWorkspaceFolder. I noticed that the extension started to work and was wondering why - it was #12 . Thank you!

@helly25
Copy link
Owner

helly25 commented Jul 18, 2024

Great to hear. I still need to find more time to debug such cases though before calling it an actual feature.

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