Hacker News
27.5KB language-agnostic WebGPU syntax highlighter
vova_hn2
|next
[-]
I wonder, if mass adoption of LLM code-generation will accelerate this process or not. On the one hand, it is now easier to "write" (LLM-generate) code then ever, so time/effort savings are not there anymore (probably, I'm not sure). On the other hand, now everyone uses LLMs so, I think, people are less deterred by non-determinism and statistical nature of ML models.
Let's imagine that you are making a CLI tool. What does a CLI tool do? Well, it accepts reads arguments, reads stdin, writes stdout and make syscalls. So, all possible inputs and outputs are very well defined. What if in the future it will be easier (and maybe even more natural) to ask an LLM to "imagine" tons of possible inputs and correct outputs for a tool that you are making and then train a tiny model, without writing or generating any code?
weinzierl
|root
|parent
[-]
I think the direction this will be going depends in part on how hardware prices will develop. If we continue with "hardware is cheap, don't think about it" like we did in the past decades I can see this happen. On the other hand, if we continue down the path we've recently taken, people who know when to choose which approach to their advantage will have a good and prosperous life.
undefeated
|next
|previous
[-]
Looks really impressive, although one issue I do see is consistency. For example, it seems to highlight `null` as a value, unless it is on the left side of an `===` expression, since it probably hasn't seen that in training.
Was it ever actually tested on languages not in the training set? Would be interesting to see if a model this small can actually generalize...
1001111
|next
|previous
[-]
thangalin
|next
|previous
[-]
https://repo.autonoma.ca/repo/treetrek/tree/HEAD/render/rule...
netghost
|next
|previous
[-]
LatticeAnimal
|next
|previous
[-]
Is this a linux issue / support issue?
vova_hn2
|root
|parent
|next
[-]
Just look up "<browser name> enable webgpu" in you favorite search system or ask an LLM chatbot "How to enable WebGPU in <browser name>?", follow the instructions and it should work just fine.
aitoolsprimer
|root
|parent
|previous
[-]
WebGPU on Linux is still the exception, not the rule. Firefox ships it enabled by default in Nightly only, not Stable or Beta, with Linux expected during 2026. Chrome enables it by default on Linux only for Intel Gen12+ (from 144) and NVIDIA with driver 535.183.01+ on Wayland (from 147); everything else is behind flags, roughly --enable-unsafe-webgpu --ozone-platform=x11 --use-angle=vulkan --enable-features=Vulkan,VulkanFromANGLE. Distro Chromium builds also differ from Google Chrome here more often than people expect.
Which matches what you saw exactly: works on iOS, black text on both Linux browsers, clean console. Worth the demo printing a one-line "WebGPU unavailable" instead of rendering black on black, because right now a missing API and a broken shader look identical from the outside.
tikimcfee
|next
|previous
[-]
brainless
|next
|previous
[-]
quietraster
|next
|previous
[-]
onion2k
|next
|previous
[-]
michaelt
|root
|parent
|next
[-]
Speak for yourself, I often accidentally open 50MB JSON files, crashing my text editor as it tries to figure out the syntax highlighting :)
avaer
|root
|parent
|previous
[-]
You generally never need to highlight a whole file, only the part you're looking at. Which by definition must be fuzzy since you don't have the full source, the part you see will not parse as a complete program so you need to guess. This is actually one of the nastier parts of writing a highlighter, and it must be done for every language.
The lesson is that if you're going to be fuzzy you might as well be learned too and the results are pretty good.
This is more useful than it appears at first glance. It would be just as useful running on the CPU, which I'm sure it can.
umpalumpaaa
|root
|parent
|next
[-]
normie3000
|root
|parent
|next
|previous
[-]
Presumably this could also be a useful trait when live highlighting of files when editing, as in-progress typing is likely to be unparseable sometimes.
silon42
|root
|parent
|previous
[-]
vidarh
|root
|parent
[-]
E.g. if you're looking at a page of Ruby, you can not in the general case know if it's inside or outside a quoted string, as the quote character can be any arbitrary character (and I really mean any. "% x " excluding the double-quotes is a valid Ruby quoted string where the quote character is space but you can e.g. pick a unicode codepoint you're not going to use anywhere else in the file)
So unless you parse from the start of the file, you're left with fuzzy matching, and that can be made good enough the vast majority of time.
hyperhello
|next
|previous
[-]
muglug
|next
|previous
[-]
Great news for a language whose last stable release was 20 years ago