Custom syntax highlighting

It would be nice to have custom syntax highlighting capabilities in an extension, along with being able to map any syntax highlighting to a file extention.

Edit

I am not suggesting changing what color goes to what type of thing, like classes and functions. Themes do that, I am suggesting that we can make our own syntax parsers, that produce tags the get sent to the theme to be colored. Like a code mirror extention.

9 Likes

Love the idea but this can already be done with themes…

3 Likes

How would I make a syntax highlighter for jinija using themes? And how would i bind poetry.lock to the toml syntax highlighting using themes? I am pretty sure themes just change the color.

3 Likes

I see. Mutltiple themes but I can see how that can get harder if you use a lot of different file types

3 Likes

Yes! This would be very cool! It would be great if a such extension also allowed you to add custom syntax highlighting to your own file types.

6 Likes

YES! This is actually something I’ve though about, I think it would be really cool.

5 Likes

Describe your Extension idea
Syntax highlighting for file types that currently don’t support syntax highlighting.
The extension would allow you to customize the codemirror grammar for file types.
What problem(s) would this Extension solve?
There are many languages that replit doesn’t have syntax highlighting for. It’s hard to build big projects in these languages without syntax highlighting and autocomplete. I would like to fix that.

Explain what you were trying to do when you came across the problem leading to this Extensions request

I have been building a huge project in the Aardvark programming language. Syntax highlighting and autocorrect would be helpful. It doesn’t even autoindent by default, and that would be so helpful to have.

5 Likes

I’m going to be working with codemirror and lezer soon for a bounty so when the extension apis get released I’ll try making this.
Assuming the apis provide enough access to the editor to pull it off I’ll implement it so you can provide a grammar or if feasible implement your own parser.

8 Likes

We definitely want to support syntax highlighting extensions!

9 Likes