Skip to content

Conversation

@Anmol202005
Copy link
Collaborator

Fixes: #55
Updated method to count and add symbol characters to the base column offset calculation.

follow up of: #54

@rdiachenko
Copy link
Member

rdiachenko commented Jul 19, 2025

@Anmol202005 please resolve conflicts and make sure this case is fixed #54 (comment)

@Anmol202005
Copy link
Collaborator Author

@Anmol202005 please resolve conflicts and make sure this case is fixed #54 (comment)

@rdiachenko Done,

Copy link
Collaborator

@timurt timurt left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

lgtm

return computePosition(tree, targetElement, cursor, this::calculateColumnOffset);
return computePosition(tree, targetElement, cursor, out -> {
int column = calculateColumnOffset(out);
if (((J.Literal) targetElement).getValueSource().matches("^[+-].*")) {
Copy link
Member

Choose a reason for hiding this comment

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

I have some doubts for this regex match, it doesn't feel right and we may miss other edge cases. Let's rethink this when we get another use case this logic doesn't cover

@rdiachenko rdiachenko merged commit a87bc8a into checkstyle:main Jul 20, 2025
3 checks passed
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.

Incorrect column position calculation for literals containing symbols

3 participants