Sublime Text 3中软件包的语法高亮显示(.tmLanguage)

Sublime Text 3中软件包的语法高亮显示(.tmLanguage)

问题描述:

我正在研究插件

使用包控件安装插件时,语法突出显示不适用于Sublime Text 3.

Syntax highlight does not work with Sublime Text 3 when plugin is installed using package control.

Error loading syntax file "Sublime Text 3/Installed Packages/robot.tmLanguage": Unable to open Sublime Text 3/Installed Packages/robot.tmLanguage

该插件位于Installed Packcages/Robot Framework Assistant.sublime-package下,即Robot Framework Assistant.sublime-package存档中的文件"robot.tmLanguage".

The plugin is under Installed Packcages/Robot Framework Assistant.sublime-package, the file 'robot.tmLanguage' in inside Robot Framework Assistant.sublime-package archive.

这是我设置路径的方式 https://github.com/andriyko/sublime-robot-framework-assistant/blob/master/rfassistant/初始化 .py

Here is how I set paths https://github.com/andriyko/sublime-robot-framework-assistant/blob/master/rfassistant/init.py

我的问题类似于此线程,但在我的情况下,该插件安装为archive(.sublime-package),而不是包含文件的文件夹.

My question is similar to this thread, but in my case the plugin is installed as archive(.sublime-package) not folder with with files.

  1. 我不确定上面提到的路径设置在python3中是否正确.

  1. I am not sure that my path settings mentioned above are correct in python3.

如何引用.sublime-package文件中的tmLanguage文件?

How can I refer to tmLanguage file that is inside .sublime-package file?

该文件应该放在哪里?完全令人困惑的是,为什么它只能在Sublime Text 2和Sublime Text 3(从github安装到dir中)上工作,而不能通过Package Control安装.

Where should I put that file? It is totally confusing why does it work on Sublime Text 2 and Sublime Text 3(when installed into dir from github) but does not work when installed via Package Control.

因此,如何设置tmLanguage文件的路径以及应将其存储在何处.只是想澄清一下,从github zip文件安装插件时,它工作正常(因为我将其内容放入Packages目录下的RobotFrameworkAssistant文件夹中).通过Package Control安装插件时,该功能不起作用.

So, how do I set path to tmLanguage file and where should I store it. Just want to clarify, that it works fine when plugin is installed from github zip file(because I put it's content into RobotFrameworkAssistant folder under Packages directory). It does not work when plugin is installed via Package Control.

问题似乎已解决.请参阅此修复.

The issue seems to be solved. Please refer to this fix.

为什么在ST3中语法设置(.tmLanguage)出现问题?

Why I had problems with syntax settings(.tmLanguage) in ST3?

因为这完全令人困惑,并且从ST3文档中不清楚该文件应位于何处. (即使它说如果在Installed Packages中找不到文件,文件也会在Packages目录中继续查找.)

Because it is totally confusing and not clear from ST3 docs where that file should be located. (Even if it says that files lookup is continued in Packages directory if file was not found in Installed Packages).

Sublime Text 3目录下有两个主"文件夹:Installed PackagesPackages.

There are two 'main' folders under Sublime Text 3 directory: Installed Packages and Packages.

使用Package Control安装插件后,它将进入Installed Packages目录,该目录打包到名为Robot Framework Assistant.sublime-package的存档文件中(实际上是ZIP文件). robot.tmLanguage文件(语法文件)位于Robot Framework Assistant.sublime-package内部.

When the plugin is installed using Package Control it goes into Installed Packages directory packed into archive file called like Robot Framework Assistant.sublime-package (which is actually ZIP file). The robot.tmLanguage file (syntax file) is inside Robot Framework Assistant.sublime-package.

所以,用几个词来说,我的问题是:如何引用该文件(应为view.set_syntax_file方法提供什么路径)?

So, in few words, my question was: how to refer to that file (what path should be provided to view.set_syntax_file method)?

不直观,但是我应该引用不存在的路径Packages/Robot Framework Assistant/robot.tmLanguage.实际上,在我的情况下,Packages目录仅包含Users文件夹.我唯一能猜到的是文件夹名称应与程序包名称相同(在本例中为Robot Framework Assistant).

Unintuitive, but I should refer to non-existent path Packages/Robot Framework Assistant/robot.tmLanguage. Actually, in my case the Packages directory contains only Users folder. The only thing, that I can guess is that folder name should be the same as package name(Robot Framework Assistant in my case).