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

Type script syntax highlighting error #7999

Closed
oaabhilash opened this issue Jun 22, 2016 · 4 comments
Closed

Type script syntax highlighting error #7999

oaabhilash opened this issue Jun 22, 2016 · 4 comments
Assignees
Labels
typescript Typescript support issues

Comments

@oaabhilash
Copy link

  • 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.

@emeryao
Copy link

emeryao commented Jun 22, 2016

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

@oaabhilash
Copy link
Author

oaabhilash commented Jun 22, 2016

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

@emeryao
Copy link

emeryao commented Jun 22, 2016

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

@dbaeumer dbaeumer added themes Color theme issues typescript Typescript support issues and removed themes Color theme issues labels Jun 22, 2016
@aeschli
Copy link
Contributor

aeschli commented Jun 27, 2016

This issue was moved to microsoft/TypeScript-TmLanguage#197

@aeschli aeschli closed this as completed Jun 27, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

4 participants