本文介绍了Sublime Text 3 编辑配色方案值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Sublime Text 3 编辑器中有以下 javascript 代码:

I have the following javascript code in my Sublime Text 3 Editor:

function get(db, segment_name, callback) {
  var query = {
    segment_name: segment_name
  };
}

图片:

我正在使用 colorSchemeEditor 来编辑我的主题的 xml,因为我想更改主题的颜色上面查询对象中的segment_name"键.我在更改此特定值时遇到了一些麻烦,它确实找到了一个范围(请参阅答案此处),但是当我更改xml 文件中的前景色,它不会改变颜色,我使用这种技术更改了其他几种颜色.这是插件所说的属于此范围的相应 xml 片段:

I am using colorSchemeEditor to edit my theme's xml, since I want to change the color of the "segment_name" key in the query object above. I have some trouble changing this particular value, it does find a scope, (see answer here), but when I change the foreground color in the xml file, it does not change the color, I have changed several other colors using this technique. Here is the corresponding xml snippet the plugin says belongs to this scope:

<dict>
  <key>name</key>
  <string>ES7 Bind Operator</string>
  <key>scope</key>
  <string>source.js constant.other.object.key.js string.unquoted.label.js</string>
  <key>settings</key>
  <dict>
    <key>fontStyle</key>
    <string>italic</string>
    <key>foreground</key>
    <string>#CDD3DE</string>
  </dict>
</dict>

当我尝试更改 #CDD3DE 值并保存时,它不会应用新颜色.我也尝试在文件上使用几种不同的语法定义,包括普通的 javascript、JavascriptES6 语法javascript Babel.

When I try to change the #CDD3DE value and save, it does not apply the new color. I have tried using several different syntax definitions on the file as well, including plain javascript, Javascript ES6 syntax and javascript Babel.

我还尝试使用链接答案中的可下载应用程序编辑主题.

I have also tried editing the theme using the downloadable application in the linked answer.

我在主题 xml 中的范围是否错误?还有其他解决方案吗?

Is my scope in the theme's xml wrong? Any other solutions?

推荐答案

在我的主题 xml 文件中添加另外 3 个列表后,我能够更改颜色,如下所示:

I was able to change the color after adding 3 more listings in my themes xml file like this:

<dict>
  <key>name</key>
  <string>Object Properties</string>
  <key>scope</key>
  <string>source.js meta.group.braces.round.js meta.group.braces.square.js meta.group.braces.curly.js constant.other.object.key.js string.unquoted.label.js</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#CDD3DE</string>
  </dict>
</dict>

<dict>
  <key>name</key>
  <string>Object Properties 2</string>
  <key>scope</key>
  <string>source.js meta.group.braces.curly.js constant.other.object.key.js string.unquoted.label.js, </string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#CDD3DE</string>
  </dict>
</dict>

<dict>
  <key>name</key>
  <string>Object Properties 3</string>
  <key>scope</key>
  <string>source.js meta.group.braces.curly meta.group.braces.curly constant.other.object.key.js string.unquoted.label.js</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#CDD3DE</string>
  </dict>
</dict>

这可能可以通过更改列表中的名称"键和/或合并列表以及添加更多范围以保持一致来改进.添加的范围是我在编辑单个 javascript 文件时发现的范围.

This could probably be improved upon by changing the "name" key on the listings and/or consolidate the listings and maybe add more scopes to keep things consistent. The scopes added were the ones I found when editing a single javascript file.

这篇关于Sublime Text 3 编辑配色方案值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 17:45