【问题标题】:Folding Styled Components Consts in VSCodeVSCode 中的折叠样式组件常量
【发布时间】:2020-03-19 04:17:38
【问题描述】:

我一直在 NextJS/React 中使用样式化组件,我喜欢它。通常,我将我的样式分解为单独的 js 文件,但由于我对 React、props、hook 和 context 等相对较新,我经常发现需要将我的样式保留在我的组件文件中。我的问题是如何在 VSCode 中折叠以下代码:

const SomeStyledComponent = styled.div`
  height: 300px;
  width: 300px;
  ...
`;

这将使我的编码生活更轻松。

谢谢

【问题讨论】:

    标签: reactjs visual-studio-code next.js styled-components


    【解决方案1】:

    您可以使用indentation 代码折叠策略。

    // settings.json
    {
    //  ...other settings
        "editor.foldingStrategy": "indentation",
    }
    

    来自settings doc

    控制计算折叠范围的策略。 auto 使用特定语言的折叠策略(如果可用)。 indentation 使用基于缩进的折叠策略。

    【讨论】:

    • 美女!谢谢!
    猜你喜欢
    • 2020-05-22
    • 2020-12-24
    • 2018-11-20
    • 2018-12-27
    • 1970-01-01
    • 2013-10-07
    • 1970-01-01
    • 1970-01-01
    • 2017-06-22
    相关资源
    最近更新 更多