Visualstudio-docs: After installing the textmate bundle... then what?

Created on 19 Dec 2018  Â·  4Comments  Â·  Source: MicrosoftDocs/visualstudio-docs

This document seems to end on something of a cliffhanger. It makes it clear where the textmate bundle should be installed (though things are a bit vague on the Mac), but then doesn't indicate how to create new files using that language's highlighting once the user has done so.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

doc-bug visual-studio-dev1prod

All 4 comments

Related to #410. I'm looking into getting more info for you.

Thanks @gewarren! My specific situation is that I've put the textmate files where (I think) they're supposed to go, but now am not sure how to say "OK, Visual Studio, now that you know how to color programming language foo, I'd like to create a new file in language foo (or to color this existing file according to language foo).

The language server documentation briefly touches on the topic of how to add TextMate grammars.

Bundles can live in a few different locations:

  • Per user

    • Lives at %userprofile%.vs\Extensions (e.g. C:\users[user].vs\Extensions)

    • Intended to hold bundles added by a user. Extenders should not put bundles here.

  • Per extension:
  • Installed languages:

    • Live in the installation directory (e.g.: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TextMate\Starterkit).

    • There is also a notion of a ‘tmtheme’ file which defines how the scopes map to Visual Studio classifications (named color keys). There is a global one that serves as a great sample that generally lives at ("C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TextMate\Starterkit\Themes\vs.tmTheme"). I don’t see any references to this in the public documentation.

When adding a bundle, I'd take a look at the 'StarterKit' directory mentioned above for samples.

Also note that for your language to be colorized, your TextMate language will have to map to scope names that are themed in the 'vs.tmtheme' mentioned above. Scope names that aren't supported in this default theme will have to be themed in your language by creating your own .tmtheme file that sits side by side with the language and has the same name.

For a sample of both the theme and the language file, see TypeScript's.

Finally, I'd recommend using VS classification instead of TextMate languages unless you are writing an out of proc language server. TextMate colorization in VS isn't as 'full-fidelity' as classification is and by virtue of being a TextMate bundle, you get primitive completion, structure guides, outlining, and word highlighting, which might be undesirable if you are attempting to build a full language service.

@bradcray I don't think there's anything else actionable on this issue. Once the textmate bundle is in the right directory it should just "work". Let me know if you feel something else needs to be added.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ogglas picture Ogglas  Â·  3Comments

ChrisMaddock picture ChrisMaddock  Â·  3Comments

rlundy picture rlundy  Â·  3Comments

wittelw picture wittelw  Â·  3Comments

realbart picture realbart  Â·  3Comments