-
Notifications
You must be signed in to change notification settings - Fork 9
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: misplaced shellcheck spans #317
fix: misplaced shellcheck spans #317
Conversation
@@ -439,8 +441,7 @@ fn calculate_span(diagnostic: &ShellCheckDiagnostic, line_map: &HashMap<usize, S | |||
.start() | |||
+ diagnostic.end_column | |||
- 1; | |||
// - 2 to discount first and last newlines |
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.
This -2 was mis-attributed to newlines and was actually a coincidental artifact of the number of line continuations in my test cases. Doh.
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.
LGTM! Thanks for this!
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.
Looks good, thanks for fixing this!
Describe the problem or feature in addition to a link to the issues.
This PR addresses the bug described in #307, wherein shellcheck highlight spans were sometimes misplaced. This was due to incorrect counting of the amount of leading whitespace stripped by
CommandSection::strip_whitespace
. To avoid duplicating logic from the aforementioned method, the whitespace counting portion was refactored into a separate method,count_whitespace
so that bothstrip_whitespace
andsanitize_command
can make use of it.Before submitting this PR, please make sure:
changes (when appropriate).
CHANGELOG.md
(see["keep a changelog"] for more information).