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

拟墨画扇 提交于 2019-12-23 03:35:22

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/51972860/how-can-i-convert-a-sublime-text-syntax-highlighting-file-to-a-textmate-syntax-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!