简体   繁体   English

是否可以“转换” Sublime文本片段以在Eclipse开普勒中使用它们?

[英]is it possible to “convert” Sublime text Snippets to use them in Eclipse kepler ?

I wonder if I can get the Java Sublime Text snippets working on Eclipse IDE (Kepler) because I think that auto completion is better in ST then in eclipse. 我想知道是否可以在Eclipse IDE(Kepler)上使用Java Sublime Text片段,因为我认为ST的自动完成比eclipse的自动完成更好。

Thank you. 谢谢。

--Sangimed. --Sangimed。

I'm not sure which way around you meant to ask that question, but here is my try at answering it. 我不确定您打算问这个问题的方式,但这是我尝试回答的问题。

Sublime Text snippets are store in the Packages directory. Sublime Text片段存储在Packages目录中。 If you were in Sublime Text 2 and went to the File menu -> Preferences -> Browse Packages... 如果您在Sublime Text 2中,然后转到“文件”菜单->“首选项”->“浏览软件包...”

It will open the local packages for your installation of ST. 它将打开本地软件包以供您安装ST。 If you look under "Java" you will find all the local information for Java that is built into ST by default. 如果您在“ Java”下查看,则会找到默认内置在ST中的所有Java本地信息。 Which should include all of the ST snippets you are looking for... they are files with the extension .sublime-snippet 其中应包含您要查找的所有ST代码段...它们是扩展名为.sublime-snippet的文件

However, here is the tricky bit. 但是,这有点棘手。 ST snippets are stored in an xml format designed for ST, so you will need to grab the data out of the "content" node in that XML file, here is an example: ST代码段以专为ST设计的xml格式存储,因此您需要从该XML文件的“ content”节点中获取数据,下面是一个示例:

<content><![CDATA[assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0]]></content>

What you need is the content inside of the CDATA: 您需要的是CDATA内的内容:

assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0

However, this won't make sense to Eclipse right away you'll need to replace the sublime annotations with Eclipse ones, see the Eclipse documentation for more details and the Sublime Text documentation on snippet details. 但是,这对Eclipse来说是没有意义的,您需要用Eclipse替换sublime批注, 有关更多详细信息 ,请参阅Eclipse文档,有关片段详细信息,请参见Sublime Text文档


But perhaps you meant you want the best of both world, Eclipse and Sublime Text together... in that case you should look at the project Subclim , which allows you to integrate the power of Eclipse inside of ST. 但是也许您的意思是希望同时拥有Eclipse和Sublime Text的双重优势……在这种情况下,您应该查看Subclim项目,该项目可让您将Eclipse的功能集成到ST内部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM