Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert a Sublime Text syntax highlighting file to a textmate syntax for visual studio?

I am trying to start using visual studio for my code editing instead of Sublime Text 3. In sublime text 3, I have a custom syntax file for a language I work in. I would like to be able to carry the syntax highlighting over to visual studio. I am not quite sure how I could do that without starting from scratch.

Any ideas?

In response to Matt, here is an update:

I have been trying to get it to work, but I have had no luck. It does say that textmate languages are supported:

https://learn.microsoft.com/en-us/visualstudio/ide/adding-visual-studio-editor-support-for-other-languages?view=vs-2017

It has not been working. I can not find a .vs folder on my computer (other than in projects). I created one, but it does not seem to be doing anything. I did however find an extensions folder in the appdata\local directory. I would really like to get this language supported, but I cannot find much documentation on how to do it

I have also been trying to follow this other guide using their example project as a guide:

https://gcthesoftwareengineer.com/2017/01/how-to-create-custom-syntax-highlighting-in-a-visual-studio-code-extension/

I have tried using their extension as it sits and it doesnt even work then for the language they created

Update 2:

I cannot find a .vs hidden folder in my user folder. Microsoft documentation says that you can drop a folder into the .vs/Extensions folder, but it does not exist. I am not quite sure how to proceed

like image 678
DaDuStMaN20 Avatar asked Dec 29 '25 23:12

DaDuStMaN20


1 Answers

You'll need to make a VS Code extension, but it's not so hard. Check out the docs first. There's an extension generator you can use to create a skeleton project.

I made a syntax highlighter recently for a semi obscure language (Asterisk dialplan), it's on my Github if you want to have a look.

The main pieces are the package.json and the syntaxes\yourlanguage.tmLanguage files. I believe Sublime uses TextMate grammars (i.e. the tmLanguage file) so you can probably just copy that across and craft your package.json and you're done.

like image 177
Matt Avatar answered Jan 01 '26 20:01

Matt