-
Notifications
You must be signed in to change notification settings - Fork 191
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
Add leniency in how positions are handled #1002
Conversation
Previously, positions with end column of 0 were rejected by the extension. CodeQL positions are supposed to be 1-based, but the CLI does handle 0-based and negative positions by using character offsets from the current line start. Instead of rejecting these kinds of positions, the extension should handle them as gracefully as possible. Fixes #999
@@ -70,7 +70,7 @@ function resolveFivePartLocation( | |||
Math.max(0, loc.startLine - 1), | |||
Math.max(0, loc.startColumn - 1), | |||
Math.max(0, loc.endLine - 1), | |||
Math.max(0, loc.endColumn) | |||
Math.max(1, loc.endColumn) |
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.
Took some staring at, but this change to endColumn
looks right.
Why don't we need the same logic for endLine
?
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.
If endLine
is 0, then that indicates the location is fully contained on the first line of the file.
The goal here is not to fix all problematic locations, but just to quickly handle some obviously incorrect ones. I am assuming that vscode itself is able to do better handling of invalid locations than we can here.
extensions/ql-vscode/CHANGELOG.md
Outdated
- Allow case-insensitive project slugs for GitHub repositories when adding a CodeQL database from LGTM. [#978](https://github.com/github/vscode-codeql/pull/961) | ||
- Make "Open Referenced File" command accessible from the active editor menu. [#989](https://github.com/github/vscode-codeql/pull/989) | ||
- Add more leniency in how locations are handled. Locations with a 0 for its end column value are no longer rejected. They are treated as the first column in the line. [#1002](https://github.com/github/vscode-codeql/pull/1002) |
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.
- Add more leniency in how locations are handled. Locations with a 0 for its end column value are no longer rejected. They are treated as the first column in the line. [#1002](https://github.com/github/vscode-codeql/pull/1002) | |
- Allow query result locations with 0 as the end column value. These are treated as the first column in the line. [#1002](https://github.com/github/vscode-codeql/pull/1002) |
9def0a7
to
56be2ec
Compare
Previously, positions with end column of 0 were rejected by the
extension. CodeQL positions are supposed to be 1-based, but the CLI
does handle 0-based and negative positions by using character offsets
from the current line start.
Instead of rejecting these kinds of positions, the extension should
handle them as gracefully as possible.
Fixes #999
Replace this with a description of the changes your pull request makes.
Checklist
@github/docs-content-codeql
has been cc'd in all issues for UI or other user-facing changes made by this pull request.