reactjs - 在 VSCode 中折叠样式组件常量

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

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

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

让我的编码生活更轻松将大有帮助。

谢谢你

最佳答案

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

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

来自 settings doc :

Controls the strategy for computing folding ranges. auto uses a language specific folding strategy, if available. indentation uses the indentation based folding strategy.

关于reactjs - 在 VSCode 中折叠样式组件常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59005304/

相关文章:

reactjs - 子组件列表未渲染

visual-studio-code - Visual Studio Code 是否支持用 C# 编写的语言服务器

visual-studio-code - 重命名文件 (F2) 的 Visual Studio 代码中的奇怪问题 - 退出编辑模式

javascript - Nextjs 静态文件 CORS 问题 - 导致链接在版本 10.1.4 上中断

node.js - 如何将 NextJS 应用程序部署到 Linux 服务器 (CentOS 7) - VPS

javascript 无法在推送时访问数组方法

javascript - react js : Image upload is not working in CKEditor

javascript - <select> 应该有 {defaultValue} 或 {value} 而不是设置 {selected}

c++ - 如何设置 VSCode C++ 来显示局部变量

node.js - NodeJS 需要多核 VPS