我一直在 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/