如何设置Atom的'styles.less'文件以突出显示Python中的函数和方法调用?

问题描述 投票:4回答:2

我想在Sublime Text中突出显示它:

enter image description here

我尝试像here建议:

atom-text-editor, atom-text-editor::shadow {
  .meta.function-call.python {
    color: '#abcde';
  }
}

然而,Atom的弃用说:

从Atom v1.13.0开始,atom-text-editor元素的内容不再封装在shadow DOM边界内。这意味着您应该停止使用:host::shadow伪选择器,并在syntax--之前添加所有语法选择器。为防止现有样式表破损,Atom将自动升级以下选择器:

  • atom-text-editor .meta.function-call.generic.python
  • atom-text-editor::shadow .meta.function-call.generic.python => atom-text-editor .meta.function-call.generic.python
  • atom-text-editor.editor .syntax--meta.syntax--function-call.syntax--generic.syntax--python

选择器的自动转换将在几个发布周期中删除,以最大限度地缩短启动时间。请确保尽快升级上述选择器。

应该是这样吗? (我试过但它不起作用)

atom-text-editor {
  .meta.function-call.python {
    color: '#66D9EF';
  }
}

atom-text-editor.editor {
  .syntax--meta.syntax--function-call.syntax--python {
    color: '#66D9EF';
  }
}

有人可以帮我突出Atom的Monokai语法颜色主题中的函数和方法调用吗?

python css atom-editor
2个回答
5
投票

您需要从颜色规则中删除''。那些不去那里。我测试过这个有效:

atom-text-editor.editor {
  .syntax--meta.syntax--function-call.syntax--python {
    color: #66D9EF;
  }
}

0
投票

此解决方案突出显示了所有函数调用:

atom-text-editor.editor {
  .syntax--source.syntax--python {
    .syntax--function-call.syntax--generic.syntax--python  {
      color: #ffc1c1;
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.