Skip to content
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

apply the provided column information to the highlighting #88

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Deployment.
- Display global inspection error and omit the option if the configured `MISRA Addon JSON` does not exist.
- Made plugin verbose level configurable via settings.
- Display all available details for findings in tooltip.
- Apply the provided column information to the highlighting.

### 1.6.2 - 2022-01-25

Expand Down
3 changes: 2 additions & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
- Display `Cppcheck Path` configuration errors as global inspection errors instead of using a (hard to spot) status bar message.<br/>
- Display global inspection error and omit the option if the configured `MISRA Addon JSON` does not exist.<br/>
- Made plugin verbose level configurable via settings.<br/>
- Display all available details for findings in tooltip.
- Display all available details for findings in tooltip.<br/>
- Apply the provided column information to the highlighting.
]]>
</change-notes>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public List<ProblemDescriptor> parseOutput(@NotNull final PsiFile psiFile,

final String fileName = locations.get(0).file;
int lineNumber = locations.get(0).line;
// TODO: use in ProblemDescriptor
final int column = locations.get(0).column;

if (verboseLevel >= 4) {
Expand All @@ -214,10 +213,10 @@ public List<ProblemDescriptor> parseOutput(@NotNull final PsiFile psiFile,
continue;
}

// Document counts lines starting at 0, rather than 1 like in cppcheck.
// Document counts lines and columns starting at 0, rather than 1 like in cppcheck.
lineNumber -= 1;

final int lineStartOffset = DocumentUtil.getFirstNonSpaceCharOffset(document, lineNumber);
final int lineStartOffset = (column == -1) ? DocumentUtil.getFirstNonSpaceCharOffset(document, lineNumber) : (document.getLineStartOffset(lineNumber) + (column -1));
final int lineEndOffset = document.getLineEndOffset(lineNumber);

String details = "";
Expand Down