diff --git a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java index 73639d6d395..8ded19a2a2c 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java +++ b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java @@ -1245,9 +1245,9 @@ protected DependencyInstallationResult preparePackagesAndDependencies(Set } DiagnosticLocation diagLoc = builder .setStartLine(err.getPosition().getLine()) - .setStartColumn(err.getPosition().getColumn()) + .setStartColumn(err.getPosition().getColumn() + 1) // convert from 0-based to 1-based .setEndLine(err.getPosition().getLine()) - .setEndColumn(err.getPosition().getColumn()) + .setEndColumn(err.getPosition().getColumn() + 1) // convert from 0-based to 1-based .build(); writeDiagnostics(msg, JSDiagnosticKind.PARSE_ERROR, diagLoc); } diff --git a/javascript/ql/integration-tests/all-platforms/diagnostics/syntax-error/diagnostics.expected b/javascript/ql/integration-tests/all-platforms/diagnostics/syntax-error/diagnostics.expected index c1ee7485218..e0a2c86415b 100644 --- a/javascript/ql/integration-tests/all-platforms/diagnostics/syntax-error/diagnostics.expected +++ b/javascript/ql/integration-tests/all-platforms/diagnostics/syntax-error/diagnostics.expected @@ -1,9 +1,9 @@ { "location": { - "endColumn": 4, + "endColumn": 5, "endLine": 1, "file": "bad.js", - "startColumn": 4, + "startColumn": 5, "startLine": 1 }, "markdownMessage": "A parse error occurred: `Unexpected token`. Check the syntax of the file. If the file is invalid, correct the error or [exclude](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning) the file from analysis.",