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

Language detection in the demo is stuck on "Delphi" #7

Open
isagalaev opened this issue Aug 2, 2023 · 6 comments
Open

Language detection in the demo is stuck on "Delphi" #7

isagalaev opened this issue Aug 2, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@isagalaev
Copy link
Member

isagalaev commented Aug 2, 2023

Typing a single character into the code box on https://highlightjs.org/demo results in the output window saying "Delphi" and code not highlighted (even valid Delphi).

image
image

I'm using Firefox, didn't try in other browsers.

@allejo allejo added bug Something isn't working browser specific Not all browsers appear to be affected labels Aug 2, 2023
@allejo
Copy link
Member

allejo commented Aug 4, 2023

hmm looks like this is only a problem during production builds, running a local development build works just fine 🤔

@isagalaev
Copy link
Member Author

By the way, just checked it happens in Chromium as well, so probably not browser specific.

@allejo allejo removed the browser specific Not all browsers appear to be affected label Aug 30, 2023
@allejo
Copy link
Member

allejo commented Sep 6, 2023

@joshgoebel I investigated this issue more, and it looks like auto-detection is crapping the bed. I haven't tried replicating this in a JSFiddle yet, but do you know what may be causing this? I can't image the Delphi grammar is this fucked with relevancy calculations.

image

@joshgoebel
Copy link
Member

You said it worked in dev mode, are these relevance numbers actually different in dev mode?

I'd remove (autodetect) from the dropdown... It was never intended to work well with all 190 grammars loaded... it's probably "better than nothing" to "ok" with just :common loaded... but it's not at all a good way to decide what a random snippet of code is. So there is no fix here that is going to always "just work".

@allejo
Copy link
Member

allejo commented Sep 6, 2023

Yes, these relevancy numbers are entirely different in development mode (actually sane compared to dev). My current theory is that Webpack is fucking something up in the bundling process, leading to these inconsistencies.

But I agree, I am leaning towards removing the auto-detection for all 190 languages and just using :common instead.

@joshgoebel
Copy link
Member

Sounds like something in the build is indeed broken. Could you just use a static build instead, like from cdn-release? Or use a much better bundler, like rollup?

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

No branches or pull requests

3 participants