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

Strange colourisation of template strings when "#/" present after first placeholder #3630

Closed
johnnyreilly opened this issue Jun 25, 2015 · 3 comments
Labels
Duplicate An existing issue was already created Fixed A PR has been merged for this issue

Comments

@johnnyreilly
Copy link

I've noticed some odd behavior with the syntax colourisation for template strings in Visual Studio 2013 (using TypeScript 1.4 plugin). It occurs when the string "#/" is present within the template string after at least one placeholder is present. I realise reading that is as clear as mud so look at the screenshot below for clarification:

image

As you can see the first 2 examples colourise in the fashion you would hope. The 3rd example behaves in an unexpected fashion after the "#/". Here's the code you can use to reproduce it with:

class highlightingBug {

    demo() {

        var urlWithoutHash =
            `i_look_kind_of_normal_${"I_think"}`;

        var urlWithHash =
            `and_so_do_I_even_with_#/_in_place_${"I_think"}`;

        var urlWithHashAfterFirstPlaceHolder =
            `${"But_me_"}_well_things_look_a_little_odd_colour_wise_after_the_#/_${"That_is_what_I_think_anyway"}`;
    }
}
@DanielRosenwasser
Copy link
Member

TypeScript 1.4 didn't have proper template string colorization support in VS2013, so I believe it thinks it's seeing the identifier _well_things_look_a_little_odd_colour_wise_after_the_, followed by invalid token #, and finally unterminated regex /_${"That_is_what_I_think_anyway"};`

If you're curious for a more technical explanation, you can check this page out on our wiki.

The short answer is, this has been fixed to a reasonable extent and will be available in TypeScript 1.5.

Marking this as a duplicate of #1477.

@DanielRosenwasser DanielRosenwasser added Duplicate An existing issue was already created Fixed A PR has been merged for this issue labels Jun 25, 2015
@johnnyreilly
Copy link
Author

Ah great! Thanks for the detail.

@DanielRosenwasser
Copy link
Member

No prob; while 1.5 proper should be out pretty soon, you can use the beta in the mean time.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants