Skip to content

Type script syntax highlighting error #197

Closed

Description

From Abhilash Achenkunju (@oaabhilash) on June 22, 2016 12:20

  • VSCode Version: 1.2.1
  • OS Version: Windows 7

Steps to Reproduce:

  1. Create a type script file with the following content
 export class sampleClass  {
        public equipmentTypeList: string[] = ["FAX", "OFFICE PHONE"];
        public pbxEquipmentType = "FAX";
        public spliceRightStripName = "TE"; 
        public cablePairStatusValues: any[] =  
            [       
                { statusText: "Assigned" },
                { statusText: "Faulty" }, 
                { statusText: "Not in Use" },
            ];
        public cablePairStatusValueForAssigned = "Assigned";
        public cablePairStatusValueForFaulty = "Faulty";
        public phoneCircuitType = "Phone";
 }
  1. The syntax highlighting after line 8 of the code above is not correct.
    Tested for following themes
    Default (Dark)
    Visual studio Dark and
    Visual Studio light
    syntaxhighlightpreview

Note: if the opening square bracket on line 7 is moved to line 6 then the syntax highlighting is OK.

Copied from original issue: microsoft/vscode#7999

Activity

  1. aeschli commented on Jun 27, 2016

    @aeschli
    Author

    From Emeryao (@emeryao) on June 22, 2016 12:27

    export class sampleClass  {
            public equipmentTypeList: string[] = ["FAX", "OFFICE PHONE"];
            public pbxEquipmentType = "FAX";
            public spliceRightStripName = "TE"; 
            public cablePairStatusValues: any[] = new Array<any>(  
                [       
                    { statusText: "Assigned" },
                    { statusText: "Faulty" }, 
                    { statusText: "Not in Use" }
                ]);
            public cablePairStatusValueForAssigned = "Assigned";
            public cablePairStatusValueForFaulty = "Faulty";
            public phoneCircuitType = "Phone";
     }

    codes above works fine on my vs code:1.3.0-insiders.

    maybe the way of directly asignning a [] to a property/field is not a very typescript way 😄

    PS: noticed that the highlight is not working even in markdown syntax with your codes, see blow and compare with the codes above

    export class sampleClass  {
            public equipmentTypeList: string[] = ["FAX", "OFFICE PHONE"];
            public pbxEquipmentType = "FAX";
            public spliceRightStripName = "TE"; 
            public cablePairStatusValues: any[] =  
                [       
                    { statusText: "Assigned" },
                    { statusText: "Faulty" }, 
                    { statusText: "Not in Use" },
                ];
            public cablePairStatusValueForAssigned = "Assigned";
            public cablePairStatusValueForFaulty = "Faulty";
            public phoneCircuitType = "Phone";
     }

    so I don't think it's a bug

  2. aeschli commented on Jun 27, 2016

    @aeschli
    Author

    From Abhilash Achenkunju (@oaabhilash) on June 22, 2016 12:39

    I just checked the typescript handbook
    https://www.typescriptlang.org/docs/handbook/basic-types.html
    It looks like the way I initialized is allowed and it does compile with tsc.
    capture

    Edit:

    I take your point regarding the markdown syntax. I guess I have to format the code differently :(

    Thanks
    Abhilash

  3. aeschli commented on Jun 27, 2016

    @aeschli
    Author

    From Emeryao (@emeryao) on June 22, 2016 12:50

    Abhilash Achenkunju (@oaabhilash)
    I think the local variable announcing by let is a little different with the proerty/field of a class.
    JUST my own opinion. 😆

  4. added a commit that references this issue on Sep 26, 2016
    25e792b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions