-
Notifications
You must be signed in to change notification settings - Fork 22
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
Error appending replacements in multi-line comments #41
Comments
😱 Crap, I'll take a look. Thanks for reporting it. Please feel free to use an earlier version until a fix is found. 🙏 |
Thinking about this a bit more, I am not even sure if multiline atomic suggestion comments are possible. Clang-tidy's replacements may span over multiple files (in particular in the example of renaming). Maybe #15 would needed to be reconsidered to support atomic suggestions. |
I haven't had time to fix this yet, but I was thinking of trying out the following logic. Replacements:
- FilePath: /home/me/projects/cpp-command-parser/include/CommandParser.h
Length: 5
Offset: 8851
ReplacementText: ''
- FilePath: /home/me/projects/cpp-command-parser/include/CommandParser.h
Length: 47
Offset: 8856
ReplacementText: " return sizeof...(Args);\n " The main difference compared to the one you posted above is that they are "consecutive", i.e. if you sum the length and the offset, you end up in the next offset (or the next offset -1 in another case). So I am hoping that we can distinguish between the two cases and support both? 🤔 What do you mean by "atomic" suggestion comments btw? |
Thanks for the example. Right, in this case it totally makes sense to have a single suggestion. So these consecutive changes should be easy to find, as By atomic suggestion, I meant a suggestion comment that contains multiple changes, but the changes only make sense together. E.g. in the renaming case, ideally you want to "apply the suggestion" for declaration, definition and all usages at the same time. |
Yeah, I've been looking for that feature... 😅 |
I am actually not very familiar with with But anyways. I think for a first step, it would be fine to only merge the "consecutive" replacements together. |
@jellespijker Can you please post your |
@florian-kuebler and @jellespijker could you please try out this fix branch: Thanks! 🙏 |
I am confident #43 is an improvement over |
So yes, #43 fixed the case mentioned above. I am going to close the issue. As mentioned above, I think there is still room for improvement, but that would be a different issue, I guess. Let's see how current master works for us. Thanks for fixing this. |
No idea either. 😅 I am planning to add some tests for this Action so hopefully we will avoid regressions in the future. 🤞 |
With #38, suggestions including multiple replacements where tried to be tackled. However, right now, replacements text is only concatenated and the length is being summed, which is a bit too simple, resulting in potentially unusable comments.
Consider the following example:
The text was updated successfully, but these errors were encountered: