Create custom syntax highlighting for all file extensions

Recently, I’ve been working on a project involving “custom” file extensions. As most of you know, on Replit, when creating a file with a file extension that doesn’t already exist, it will be created as a .txt file, or in other words, a file containing plain text. Since I’m trying to create a new language, I find it incredibly irritating that the text in my file is always white. There’s currently no built-in way to change this, and I think that there should be.

For example, the extension .py and .html both get their own syntax highlights. However, if you copied the contents of a .py file to a .txt file, the code inside the .py file would have syntax highlights, whereas the .txt file would become white and colorless without syntax highlights. If you put in your own format, for example, .myl, it would be the same as the .txt file - white and colorless.
I’m that saying you should be able to take the syntax highlighting from that .py file I mentioned before, and apply it to the .txt and .myl files. In addition to what I just mentioned, you should be able to customize the syntax highlighting like you can with themes, except the it would be specific to each file type.

2 Likes

Welcome catbox305 to the forum
I also think this should be a feature

for now, if the python syntax highlighting works for your language, you could make it use a .myl.py extension instead, or you could edit your .myl file on replit through a .py symlink. For example, run in shell:

ln -s coolfile.py coolfile.myl
1 Like

The problem I have is that my language uses its own syntax, and is interpreted with python. So, I can’t symlink it (I’ll just assume that symlink means to “disguise” the file as another extension, feel free to correct me if I’m wrong) because it’s not a python file, and isn’t meant to be.

(btw for context .myl shown above is standing for “my language”, the actual project uses .mud, .stmud, and .bmud. I can put a link to the project if you’d like.)

1 Like

if you have custom syntax for their language, you can write a Codemirror 6 mode and email faris@repl.it—here’s a template https://replit.com/@util/CodeMirror-Lezer-Language-Template

1 Like

How exactly do I use that template?