Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding a new textmate grammar to visual studio 2015 update 1

In the visual studio 2015 update 1 release blog post (https://blogs.msdn.microsoft.com/visualstudio/2015/11/30/visual-studio-update-1-rtm/) the ability to add textmate bundles (or grammars) is explicitly mentioned:

Editor support for new languages. The Visual Studio editor now provides built-in syntax highlighting and basic IntelliSense support for languages including Go, Java, Perl, R, Ruby, and Swift. We support the TextMate bundle model for language grammars and snippets, allowing you to extend this with support for other languages.

I want to create a new textmate grammar for my own language, but I cannot find any documentation, how to do this in vs2015 update 1.

The best source I found is this reddit conversation: https://www.reddit.com/r/programming/comments/3uvwn3/visual_studio_2015_update_1/

It looks like it's implemented as an extension, "Visual Studio Extension for Textmate Grammars." If you search for *.tmbundle in your visual studio\Common7\IDE\Extensions directory you will find the location of the tmbundles. I just made a new folder for Julia and copied the Julia tmbundle to it. Seems to work.

Is this the supported way of doing this? Why isn't there any documentation, visual studio menu etc. for this?

like image 814
Botond Xantus Avatar asked Feb 18 '16 20:02

Botond Xantus


People also ask

How do I add another language to Visual Studio?

To do so: Choose the Language packs tab in the Visual Studio Installer. Select the language you prefer. Follow the prompts.

What is TextMate grammar?

TextMate is free-form in the sense that you can assign basically any name you wish to any part of the document that you can markup with the grammar system and then use that name in scope selectors.

What is Visual Studio language pack?

You need the Visual Studio Language Packs to test your extension with localized versions of Visual Studio. Language packs are provided only for Visual Studio 2012 and higher. Previous versions require the installation of the full Visual Studio localized version or at least the localized Visual Studio Integrated Shell.

What languages does Microsoft Visual Studio support?

Visual Studio offers powerful HTML, CSS, JavaScript, and JSON editors. Tap into the power of LESS, and Sass, use PHP, Python, or C# with ASP.NET. All the popular languages are supported and you can move between languages and project types with ease.


2 Answers

Looks like there's an extension from Mads Kristensen now that provides a large number of TextMate syntaxes into Visual Studio. Looks like it's easy to add additional languages as well... You can probably check out the repo and see exactly what's required to add additional syntax.

http://vsixgallery.com/extension/4773ce75-6f30-4269-9557-1f7c30a47be2/

like image 41
Rick Strahl Avatar answered Sep 29 '22 11:09

Rick Strahl


You can do this the way you've done it above, or if you prefer it to be in your user profile directory rather than across the whole operating system installation, you can add the bundle here:

%USERPROFILE%\.vs\Extensions\

On most machines, that path expands to:

C:\User\<yourusername>\.vs\Extensions\
like image 154
Macker Avatar answered Sep 29 '22 12:09

Macker