How to setup Atom's 'styles.less' file to highlight function and method call in Python?

我怕爱的太早我们不能终老 提交于 2019-12-06 05:08:57

问题


I would like to have it highlighted like here in Sublime Text:

I tried like suggested here:

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

However, Atom's deprecation says:

Starting from Atom v1.13.0, the contents of atom-text-editor elements are no longer encapsulated within a shadow DOM boundary. This means you should stop using :host and ::shadow pseudo-selectors, and prepend all your syntax selectors with syntax--. To prevent breakage with existing style sheets, Atom will automatically upgrade the following selectors:

  • 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

Automatic translation of selectors will be removed in a few release cycles to minimize startup time. Please, make sure to upgrade the above selectors as soon as possible.

Should it be like this? (I tried but it doesn't work)

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

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

Could someone help me to highlight function and method calls in Atom's Monokai syntax color theme?


回答1:


You need to remove the '' from the color rule. Those don't go there. I tested and this works:

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



回答2:


This solution highlighted all function calls for me:

atom-text-editor.editor {
  .syntax--source.syntax--python {
    .syntax--function-call.syntax--generic.syntax--python  {
      color: #ffc1c1;
    }
  }
}


来源:https://stackoverflow.com/questions/44721230/how-to-setup-atoms-styles-less-file-to-highlight-function-and-method-call-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!