双文件类型扩展:Sublime Text 3 中正确的语法高亮 [英] Double Filetype Extension: Correct Syntax Highlighting in Sublime Text 3

查看:51
本文介绍了双文件类型扩展:Sublime Text 3 中正确的语法高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一些 .scss.liquid 文件,它们总是以 HTML Liquid 打开,无论我设置了多少次语法.

I am working with some .scss.liquid files and they always open as HTML Liquid, no matter how many times I set the syntax.

更新:

我尝试了 open all with current extension as 选项,但不幸的是这会影响 .js.liquid 的文件.html.liquid 也是如此.

I tried open all with current extension as option, but unfortunately this affects files that are .js.liquid and .html.liquid as well.

推荐答案

Sublime Text 允许您基于每种语言(实际上是每种语法)应用设置.可用设置之一允许您将文件扩展名映射到给定的语法.

Sublime Text allows you to apply settings on a per-language basis (actually, per syntax). One of the available settings allows you to map file extensions to the given syntax.

假设您使用名为 SCSS 的语法,在您的用户设置中创建一个 SCSS 设置文件:/path/to/packages/User/SCSS.sublime-settings,然后添加文件扩展名设置:

Assuming you're using a syntax named SCSS, Create an SCSS settings file in your User settings: /path/to/packages/User/SCSS.sublime-settings, then add the file extension setting:

{
    "extensions":
    [
        "scss.liquid"
    ]
}

如您所见,它是一个json文件,而extensions是一个列表,因此您可以根据需要添加任意数量的文件扩展名.不要添加前导点.

As you can see, it's a json file, and extensions is a list, so you can add as many file extensions as you need. Do not add the leading dot.

设置文件的文件名必须与实际的语法名称匹配,包括大小写.在这种情况下,它必须是 SCSS.sublime-settings.其他示例包括:

The file name for the settings file must match the actual syntax name, including case. In this case it has to be SCSS.sublime-settings. Other examples include:

NAnt Build File.sublime-settings
Ruby on Rails.sublime-settings
Rd (R Documentation).sublime-settings
Java Server Page (JSP).sublime-settings

这篇关于双文件类型扩展:Sublime Text 3 中正确的语法高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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