Sublime Text 3 片段在没有扩展名的纯文本文件中不起作用 [英] Sublime Text 3 snippet not working in plain text file with no extension

查看:82
本文介绍了Sublime Text 3 片段在没有扩展名的纯文本文件中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在纯文本文件中使用以下代码段,特别是之前文件已使用扩展名保存或设置了语法.

I have the following snippet that I would like to work in a plain text file, specifically before the file has been saved with an extension or having set a syntax.

<snippet>
    <content><![CDATA[
/* yay this is your generic test snippet */
]]></content>
    <tabTrigger>generic</tabTrigger>
    <scope>text.plain</scope>
    <description>Generic any scope snippet</description>
</snippet>

但是,当我在新文件中键入 generic 时它不起作用.我已经对 sublime 用户设置进行了此更改:

However it doesn't work when I type generic in a new file. I have already made this change to sublime user settings:

    "auto_complete_selector": "source, text, source - comment"

后续注意事项
从代码段定义中省略 应该使它在所有范围内都可用,它对我使用 sqlmarkdown 中的上述代码段> 范围.

Follow-up note
Omitting the <scope> from the snippet definition should make it available in all scopes, it worked for me with the above snippet in sql and markdown scopes.

推荐答案

我能够通过执行以下操作来修复,但我会接受任何其他更好的答案.

I was able to fix by doing the following, but I'll accept any other better answer.

在特定于语法(纯文本)的用户设置中,我将 "" 添加到扩展字段:

In syntax-specific (plain text) user settings I made added the "" to the extensions field:

"extensions":
[
    "txt", ""
],

现在该代码段适用于新创建的未保存文件或没有扩展名的文件.

Now the snippet works in newly created unsaved files, or files without an extension.

这篇关于Sublime Text 3 片段在没有扩展名的纯文本文件中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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