Skip to content

Paragraph separator character causes TS Server to get into bad state #38078

@mjbvz

Description

@mjbvz

From microsoft/vscode#95685

TypeScript Version: 3.9.0-dev.20200420

Search Terms:

  • invisible character
  • paragraph
  • diagnostics / errors

Code
For the JS

var ftext = ["Und", "dann", "eines"];
var a = 1;

Note there is an invisible paragraph separator character after the opening[

  1. In the file, delete the space after the = on the second line.

Bug:
TS starts reporting bogus errors:

Screen Shot 2020-04-20 at 3 31 24 PM

It looks the paragraph character messes up the parsing and causes the error line numbers to be off by one

[Trace  - 22:31:41.88] <semantic> Event received: semanticDiag (0).
Data: {
    "file": "/Users/matb/projects/san/test.js",
    "diagnostics": [
        {
            "start": {
                "line": 2,
                "offset": 8
            },
            "end": {
                "line": 2,
                "offset": 12
            },
            "text": "Cannot find name 'dann'.",
            "code": 2304,
            "category": "error"
        },
        {
            "start": {
                "line": 2,
                "offset": 16
            },
            "end": {
                "line": 2,
                "offset": 21
            },
            "text": "Cannot find name 'eines'.",
            "code": 2304,
            "category": "error"
        }
    ]
}

Metadata

Metadata

Assignees

Labels

ExternalRelates to another program, environment, or user action which we cannot control.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions