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

The auto-updated csharp language has an issue with OnigScanner #219

Closed
orta opened this issue Sep 2, 2021 · 6 comments · Fixed by #231
Closed

The auto-updated csharp language has an issue with OnigScanner #219

orta opened this issue Sep 2, 2021 · 6 comments · Fixed by #231
Labels
bug Something isn't working

Comments

@orta
Copy link
Contributor

orta commented Sep 2, 2021

https://github.com/shikijs/shiki/pull/218/checks?check_run_id=3497151928#step:10:10

  ● validates all languages can show a hello-world › csharp

    105,110,118,97,108,105,100,32,112,97,116,116,101,114,110,32,105,110,32,108,111,111,107,45,98,101,104,105,110,100
     |     let result = grammar.tokenizeLine2(line, ruleStack)
     |     let tokensLength = result.tokens.length / 2
     |     for (let j = 0; j < tokensLength; j++) {

      at OnigScanner.findNextMatchSync (node_modules/onigasm/src/OnigScanner.ts:129:27)
      at node_modules/vscode-textmate/release/webpack:/vscodetextmate/out/grammar.js:586:26
      at lineTokens (node_modules/vscode-textmate/release/webpack:/vscodetextmate/out/grammar.js:537:5)
      at f (node_modules/vscode-textmate/release/webpack:/vscodetextmate/out/grammar.js:706:13)

@orta orta added the bug Something isn't working label Sep 2, 2021
@Gerrit0
Copy link
Contributor

Gerrit0 commented Sep 5, 2021

Of course, I didn't see this until now... more info:

"105,110,118,97,108,105,100,32,112,97,116,116,101,114,110,32,105,110,32,108,111,111,107,45,98,101,104,105,110,100"
.split(",").map(c => String.fromCharCode(+c)).join("")

Gives the error, "invalid pattern in look-behind"

@octref
Copy link
Collaborator

octref commented Sep 16, 2021

Good catch. Let's point to an old version for now to make master green. I subscribed to the upstream issue so once this is fixed I'll upgrade to latest.

@octref
Copy link
Collaborator

octref commented Sep 16, 2021

Let's track the dotnet one for latest C# grammar. Master is green again!

octref added a commit that referenced this issue Sep 16, 2021
fix: update to latest grammar from dotnet/csharp repo. fix #219
@srmagura
Copy link
Contributor

srmagura commented Sep 22, 2021

Just wanted to point out two things, which you may already be aware of 😅

  1. This error is affecting the latest version of shiki that's published on npm (0.9.11), not just master.
  2. This error also affects the razor language, which makes sense since Razor is based on C#.

Code that produces the error (with shiki 0.9.11):

const shiki = require("shiki");

shiki
  .getHighlighter({
    theme: "nord",
  })
  .then((highlighter) => {
    console.log(
      highlighter.codeToHtml(
        `
using (var sha256 = SHA256.Create())
{
}
`,
        "razor"
      )
    );
  });

srmagura added a commit to srmagura/shiki that referenced this issue Oct 3, 2021
So that the fix to shikijsgh-219 gets released. @Gerrit0 recommended I do this.
@zoubingwu
Copy link

May I ask when will there be a 0.9.12 release? my current blog build is broken with csharp code 😢

@orta
Copy link
Contributor Author

orta commented Oct 12, 2021

thanks for the ping, I missed that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants