Thread 105980493 - /g/ [Archived: 124 hours ago]

Anonymous
7/21/2025, 8:52:26 PM No.105980493
20250721_214524
20250721_214524
md5: 4442d9aa505988d0c66ee531400e5282🔍
So I'm thinking about a novel way to think about syntax highlighting that I can implement for my text editor. I was thinking, what if the way we do it now - basically highlighting words instead of logical blocks - is retarded. Like you can see I've added a regexp to basically tune out all but the last item in each call chain, so that they're grayish and so that I pay attention to the actual function call. What are some other non-standard ideas for syntax highlight? What would you really want?
Replies: >>105980595 >>105980758 >>105981020 >>105981249 >>105981413
Anonymous
7/21/2025, 9:04:27 PM No.105980595
>>105980493 (OP)
>What are some other non-standard ideas for syntax highlight? What would you really want?
Highlighting each scope depth distinguishable, while preserving all semantics consistently in the highlight. Kind of like this package for Emacs: https://github.com/alphapapa/prism.el
Replies: >>105980658
Anonymous
7/21/2025, 9:10:16 PM No.105980658
>>105980595
It's nice there are alternative ideas like that out there, but this is definitely not what I like. It seems to be designed for languages that favor a lot of nesting, so basically Python, old school js as Lisp, it seems. I dislike the approach and the spahgetty code it results in, because I think it's good to keep code as flat as possible (visually speaking). I think I understand why Go opted out for method syntax which makes it so that methods are just functions with an extra set of parentheses on top.
Anonymous
7/21/2025, 9:22:36 PM No.105980758
>>105980493 (OP)
I don't like it, "document" is "document" and "Mode" is "Mode" no matter what you do with them, making them different just adds confusion
Replies: >>105980836
Anonymous
7/21/2025, 9:30:43 PM No.105980836
>>105980758
So, maybe you misunderstood. Picrel isn't like the perfect syntax highlight. There's some conflict between my regexp and Vim defaults that prevents code in parantheses or after == to be dimmed the way I described. The idea, however, is that in a call chain like a.b.c.d.E() all but E() are dimmed, so that you can focus on what's important, which is the function call.
Anonymous
7/21/2025, 9:50:31 PM No.105981020
>>105980493 (OP)
here's an idea
you select blocks of code in multiple files
and then you have a special tab that lists all those selections at once where you can see and edit them all
on save those blocks get saved to their actual place in their files
Replies: >>105981099
Anonymous
7/21/2025, 9:59:11 PM No.105981099
>>105981020
Even though it has northing to do with syntax highlighting, I like it, thanks anon! Totally doable and useful too, I myself often end up switching between multiple files via tabs or splits and it's not as comfy as you what you suggested.

Of course, while doable, it's clearly non trivial with all the edge cases and also I was thinking the process of selecting lines in the first place is kinda of cumbersome. But yeah, very cool idea overall.
Replies: >>105981300
Anonymous
7/21/2025, 10:16:58 PM No.105981249
1721966628103478
1721966628103478
md5: 86c6f39afc265b7f155325cfee6ea2fa🔍
>>105980493 (OP)
>What are some other non-standard ideas for syntax highlight? What would you really want?
The ideal would be representing the program text as a tree so arbitrary highlighting rules could be applied, like a cumulative tint added each time a function is called so you can visually see which functions are called more or less often, or where nested for loops are tinted deeper reds for each level of nesting
Replies: >>105981310
Anonymous
7/21/2025, 10:22:50 PM No.105981300
>>105981099
it would be very important to allow selection of multiple blocks within the same file
Replies: >>105981727
Anonymous
7/21/2025, 10:24:01 PM No.105981310
>>105981249
>nested for loops are tinted deeper reds for each level of nesting
good one
Anonymous
7/21/2025, 10:37:45 PM No.105981413
>>105980493 (OP)
Look into Projectional Editors, which the TLDR:
>instead of thinking in chars and strings, you think and edit in nodes for a tree
https://github.com/yairchu/awesome-structure-editors
https://www.youtube.com/watch?v=iN2PflvXUqQ
https://en.wikipedia.org/wiki/Structure_editor
Replies: >>105983428
Anonymous
7/21/2025, 11:16:41 PM No.105981727
VID_20250721_052500_thumb.jpg
VID_20250721_052500_thumb.jpg
md5: 4e324f09df7eab8f33df89da0548add1🔍
>>105981300
Unironically, I've just implemented it
Anonymous
7/22/2025, 2:45:22 AM No.105983428
>>105981413
oh god no just no. There's a million reasons why structure editors completely failed.