在 Sublime Text 3 (build 3103) 中突出显示 jQuery $ 变量 [英] Highlight the jQuery $ variable in Sublime Text 3 (build 3103)

查看:32
本文介绍了在 Sublime Text 3 (build 3103) 中突出显示 jQuery $ 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2016 年 2 月,build 3103 的更新打破了我的一个自定义主题,主要是关于 Javascript.我真的很怀念以 $ 为目标的能力,现在似乎在范围内:

In Feb 2016, the update to build 3103 broke a custom theme of mine, mostly in regard to Javascript. I really miss the ability to target the $, it seems that it's now under the scope:

meta.function-call.with-arguments.js variable.function.js 修改主题时.

我想知道是否有办法绕过或推翻 $ 符号,也许是一些 REGEX 或一种将范围添加到 .tmLanguage 文件的方法,以便我可以将它的颜色与其他变量函数"不同.

I want to know if there's a way to bypass or over-rule the $ sign, perhaps some REGEX or a way to add scope into the .tmLanguage file, so that I may color it differently from other "variable functions".

推荐答案

在更新未付费/非开发 Sublime Text 3 >= build 3106 之前,请按照这些说明在 JavaScript 中对 $ 变量进行主题化,或者以其他方式允许更新的主题正常运行.

Until the unpaid/non-dev Sublime Text 3 is updated >= build 3106, follow these instructions to theme your $ variable in JavaScript or otherwise allow updated themes to function properly.

  1. 在您的计算机上,转到 Sublime Text 3\Data\Packages 并创建一个名为JavaScript"的新文件夹.

  1. On your computer, go to Sublime Text 3\Data\Packages and make a new folder named "JavaScript", exactly that.

访问 https://github.com/sublimehq/Packages/blob/master/JavaScript/JavaScript.sublime-syntax

复制该文本,在新的 JavaScript 文件夹中另存为 JavaScript.sublime-syntax.这将更新语法以接受 $ 作为其自己的范围.

Copy that text, save as JavaScript.sublime-syntax in your new JavaScript folder. This will update the grammar to accept $ as its own scope.

您现在可以定位 variable.other.dollar.only.js 和 punctuation.dollar.js

You can now target variable.other.dollar.only.js and punctuation.dollar.js

修改主题

如果尚未更新,请将其添加到您最喜欢的主题中!根据您的喜好更改前景.

Add this to your favorite theme if it hasn't been updated! Change the foreground to your liking.

<dict>
    <key>name</key>
    <string>jQuery $</string>
    <key>scope</key>
    <string>punctuation.dollar.js</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#b3935cff</string>
    </dict>
</dict>

这篇关于在 Sublime Text 3 (build 3103) 中突出显示 jQuery $ 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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