TypeStrong / atom-typescript

The only TypeScript package you will ever need
https://atom.io/packages/atom-typescript
MIT License
1.13k stars 205 forks source link

String `") {"` breaks subsequent tokens #481

Closed basarat closed 9 years ago

basarat commented 9 years ago

E.g.

function write(str:string){
}

write(") {");
// var foo = 123;

Look like:

image

basarat commented 9 years ago

/cc @Cu3PO42 perhaps rule ordering is significant?

Cu3PO42 commented 9 years ago

I'll definitely look into this later today. Seems very weird to me, though.

Cu3PO42 commented 9 years ago

@basarat I actually can't reproduce this.

screen shot 2015-07-24 at 16 00 41

basarat commented 9 years ago

Try the "exact" code I posted. The code you posted is very different.

Cu3PO42 commented 9 years ago

I thought you were referring to the ){ at the end of the function definition for write and just added more tokens to confirm that wasn't broken. Sorry for that misunderstanding.

screen shot 2015-07-25 at 11 53 13

I can reproduce this now, however this is also broken in the transpired JavaScript as you can see above. I suspect this is a bug in the string definition method calling definition from the JS grammar. I'll investigate a bit and open an issue there if appropriate.

basarat commented 9 years ago

, however this is also broken in the transpired JavaScript as you can see above.

I half expected that :rose: :)

Cu3PO42 commented 9 years ago

Right, the issue on the JavaScript grammar is still there, but I "manually" fixed it for TS files.

winstliu commented 9 years ago

I just fixed this in language-javascript so it should be out in the next Atom release.