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

Strings ending in "\\" break syntax highlighting #94

Open
joshuacc opened this issue Oct 17, 2022 · 2 comments
Open

Strings ending in "\\" break syntax highlighting #94

joshuacc opened this issue Oct 17, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Contribution requested

Comments

@joshuacc
Copy link

The following is syntactically correct code, but it breaks syntax highlighting.

let myVar = "a\\";
let myOtherVar = "whatever";

image

@joshuacc joshuacc changed the title Strings ending in "\\" breaks syntax highlighting Strings ending in "\\" break syntax highlighting Oct 17, 2022
@rosshamish
Copy link
Owner

Thanks for the report. I'll try to take a look at some point. If any other contributors want to take a stab at this, it should be some regex change in the tmlanguage file.

@rosshamish rosshamish added bug Something isn't working good first issue Good for newcomers help wanted Contribution requested labels Oct 17, 2022
@rosshamish
Copy link
Owner

rosshamish commented Oct 17, 2022

Looks like the Escapes section of the tmLanguage.yml needs to be updated to allow for other escape sequences. Currently it suports escaping single and double quotes. Needs \t, \n, \\. We can add a test case in kusto-syntax-highlighting\test\snapshots\data-types\strings.kql to cover this by putting a \\ at the end of the string on line 22.

tmLanguage.yml, currently:

  Escapes:
    patterns:
      - match: \\['"]
        name: constant.character.escape.kusto

Proposed fix:

  Escapes:
    patterns:
      - match: \\['"tn\\]
        name: constant.character.escape.kusto

and then

  1. npm run convert to convert the yml to json
  2. npm run test to check that the tests look right
  3. npm run test:update-snapshot to update the snapshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Contribution requested
Projects
None yet
Development

No branches or pull requests

2 participants