简体   繁体   English

如何在Sublime Text 3中进行自动完成课程?

[英]How to make autocomplete class in sublime text 3?

How do I get when I type container in the sublime, this appears autocomplete : <div class="container"></div> . 当我在崇高状态下输入container时,如何显示自动完成: <div class="container"></div> I had installed package, but it's not working 我已经安装了软件包,但是无法正常工作

Thank you 谢谢

Update : 更新

I follow this tutorial : https://github.com/alienhard/SublimeAllAutocomplete/ 我遵循本教程: https : //github.com/alienhard/SublimeAllAutocomplete/

I try in terminal windows like this : https://postimg.org/image/qt3zf3v0t/ 我在这样的终端窗口中尝试: https : //postimg.org/image/qt3zf3v0t/

Then, I try autocomplete in sublime, but it still does not work 然后,我尝试升华自动完成功能,但仍然无法正常工作

In Sublime, these are known as snippets. 在Sublime中,这些称为摘要。

You can create a new one by selecting Tools > Developer > New Snippet... , where you'll find a skeleton to help define your new snippet. 您可以通过选择工具>开发人员>新建代码段...来创建一个新的代码段,在其中您可以找到一个框架来帮助定义新的代码段。 Based on your question, I think you'd want something like this: 根据您的问题,我想您需要这样的东西:

<snippet>
    <content><![CDATA[
<div class="container"></div>
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>container</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>

The code defined inside the <![CDATA[…]]> section is the actual snippet, the full text you want the autocomplete to result in. <![CDATA[…]]>部分中定义的代码是实际的代码段,即希望自动完成的全文。

The tabTrigger defines the biggest word you have to type for the content to be suggested. tabTrigger定义了要建议的内容时必须输入的最大单词。 In this case, typing a sub-word of 'container' ( c , co , con , ... container ) will trigger the content to appear in the drop-down box. 在这种情况下,键入“ container”的子词( ccocon ,... container )将触发内容出现在下拉框中。

Save the file to the default location with the extension .sublime-snippet for it to take effect. 使用扩展名.sublime-snippet将文件保存到默认位置,以使其生效。

More information is available in the unofficial sublime docs . 更多信息可在非官方的崇高文档中找到

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

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