如何将Sublime Text语法突出显示文件转换为Visual Studio的textmate语法? [英] How can I convert a Sublime Text syntax highlighting file to a textmate syntax for visual studio?

查看:111
本文介绍了如何将Sublime Text语法突出显示文件转换为Visual Studio的textmate语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图开始使用Visual Studio而不是Sublime Text 3进行代码编辑.在Sublime Text 3中,我有一个使用的语言的自定义语法文件.我希望能够进行语法突出显示转到Visual Studio.我不太确定如何从头开始就可以做到这一点.

有什么想法吗?

为回应Matt,这是一个更新:

我一直在努力使其正常运行,但是我没有运气.它确实说支持textmate语言:

https://docs.microsoft.com/zh-cn/visualstudio/ide/adding-visual-studio-editor-support-for-other-language?view=vs-2017

它没有工作.我在计算机上(项目中除外)找不到.vs文件夹.我创建了一个,但似乎没有做任何事情.但是,我确实在appdata \ local目录中找到了扩展文件夹.我真的很想获得这种语言的支持,但是我找不到关于如何使用该语言的大量文档

我也一直在尝试以他们的示例项目为指南来遵循此其他指南:

解决方案

您需要进行VS Code扩展,但这并不难.首先查看文档.有一个扩展程序生成器,可用于创建框架项目.

我最近为半模糊语言(星号拨号计划)制作了一个语法突出显示工具,它位于我的 Github 如果您想看看.

主要部分是package.jsonsyntaxes\yourlanguage.tmLanguage文件.我相信Sublime使用TextMate语法(即tmLanguage文件),因此您可能只需将其复制并制作您的package.json就可以了.

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://docs.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

解决方案

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.

这篇关于如何将Sublime Text语法突出显示文件转换为Visual Studio的textmate语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆