Skip to content

Compiler error messages have incorrect column and line numbers #20948

@IgorMinar

Description

@IgorMinar

I'm submitting a...


[x] Bug report  

Current behavior

Given a template:

<table>
  <tr *ngFor="let issue of issues | async">
    <td>{{issue.priorityScore}}</td>
    <td>{{issue.number}}</td>
    <td>{{issue.title}}</td>
    <td>
      {{issue.labels.join(','}}
    </td>
  </tr>
</table>

I get error:

ERROR in : Parser Error: Missing expected ) at the end of the expression [
      {{issue.labels.join(','}}
    ] in /Users/iminar/Dev/ng-hq/client/src/app/app.component.html@5:8 ("
    <td>{{issue.number}}</td>
    <td>{{issue.title}}</td>
    <td>[ERROR ->]
      {{issue.labels.join(','}}
    </td>
  </tr>
")

Today there are at least these problems:

  • the column and line numbers are 0-based, which is not how IDEs or even JS VMs typically work
  • the column number seems to be off in a way that I can't pinpoint. In the best case, it points to the beginning of the binding and not place in the expression (in the case of expression errors).

Expected behavior

I'd expect to get line and column numbers that I could use in my IDE to navigate to the problematic code position (via webstorm, vim, vs code, etc).

Minimal reproduction of the problem with instructions

Create a template that looks like this:

{{issue.labels.join(','}}

And you get an error:

ERROR in : Parser Error: Missing expected ) at the end of the expression [{{issue.labels.join(','}}] in /Users/iminar/Dev/ng-hq/client/src/app/app.component.html@0:0 ("[ERROR ->]{{issue.labels.join(','}}")


webpack: Failed to compile.

I'd expect the coordinates to be: 1:3 or even better 1:21.

What is the motivation / use case for changing the behavior?

Environment


framework: 5.1.0
cli: 1.6.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions