-
Notifications
You must be signed in to change notification settings - Fork 316
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
Fix _virtual_includes handling for absolute strip_include_prefix paths #5969
Fix _virtual_includes handling for absolute strip_include_prefix paths #5969
Conversation
stripPrefix = stripPrefix.substring(0, stripPrefix.length() - 1); | ||
} | ||
String externalWorkspaceName = key.getLabel().externalWorkspaceName(); | ||
WorkspacePath stripPrefixWorkspacePath = stripPrefix.startsWith("//") ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please make //
a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting the PR and my apologies that I wasn't able to check the issue earlier. There's already a test in ExecutionRootPathResolverTest
, could you please add extra tests there that test both issues mentioned?
} | ||
String externalWorkspaceName = key.getLabel().externalWorkspaceName(); | ||
WorkspacePath stripPrefixWorkspacePath = stripPrefix.startsWith("//") ? | ||
new WorkspacePath(stripPrefix.substring(2)) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also could you please make 2
a constant as well
3421a98
to
d556502
Compare
@ujohnny - I just pushed some commits to address feedback. |
@ujohnny - Could you take a look at the updates? I believe I've addressed all the feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ujohnny - Could you take a look at the updates? I believe I've addressed all the feedback.
My apologies for a little delay with reviews. Overall LGTM, though I spotted some caching issue that after upgrade to the version with the patch the header is still resolved incorrectly (from target with strip..//
) unless I perform "Non-incremental sync".
Just merged it and spotted a minor issue. Could you please submit a PR with this simple change?
|
Checklist
Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See
the Contributions section in the README for more
details.
Discussion thread for this change
Issue number: #5513
Description of this change
This change updates the
VirtualIncludesHandler.java
to detect if thestripPrefix
is a repository-relative path (e.g. starts with '//') and if so, skips concatenating it to the package path. This enables CLion to find headers in targets that use repository-relative paths forstrip_include_prefix
.I also fixed a small bug where the plugin raises an
IllegalArgumentException
when thestrip_include_prefix
ends with a '/'. To fix it we just need to trim the trailing '/' before creating theWorkspacePath
object.