Pycharm中的SCSS语言注入 [英] SCSS Language Injection in Pycharm

查看:1290
本文介绍了Pycharm中的SCSS语言注入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为PyCharm编写语言注入,它将识别中的任何内容< style type =text / x-scss>< / style> 标记为SCSS。通过对IntelliJ和PSI文档的一些检查,以及IntelliLang.xml文件的直接编辑,这是我得到的最接近的:

I'm trying to write a language injection for PyCharm that will recognize anything within a <style type="text/x-scss"></style> tag as SCSS. Through some inspection of IntelliJ and the PSI documentation, and direct editing of the IntelliLang.xml file, this is the closest I've gotten:

+ xmlTag().withChild(xmlAttribute().withLocalName(string().equalTo("type")).withValue(string().equalTo("text/x-scss"))).withNamespace(string().equalTo("http://www.w3.org/1999/xhtml"))

然而,这(a)似乎没有做任何事情,并且(b)一旦我关闭语言注入窗格,PyCharm将Java重写为 xmlTag()。withLocalName (串()匹配( <无> 中))。什么是正确的方法来实现这一目标并保存?

However, this (a) seems not to do anything, and (b) as soon as I close the Language Injections Pane, PyCharm rewrites the Java as xmlTag().withLocalName(string().matches("<none>")). What's the right way to do this and to get it to save?

推荐答案

原来有一种内置的方法可以做这与SASS特别相同。

Turns out there is a built-in way to do this with SASS specifically.

WebStorm中的语言注入(scss into html)

只需将您的标记看起来像这样:

Simply have your tag look like this:

<style rel="stylesheet/scss" type="text/css">

在我们的例子中,我们使用Django压缩器,所以这也很好:

In our case, we use Django compressor, so this works fine as well:

<style rel="stylesheet/scss" type="text/x-scss">

这篇关于Pycharm中的SCSS语言注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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