visual-studio-code - VS Code - 空行上的制表符大小
问题描述
我在 Visual Studio Code 中有以下设置:
"editor.tabSize": 4
"editor.insertSpaces": true
但是,当我删除一个新行并点击tab
时,编辑器会插入 8 个空格:
我没有启用任何扩展。有没有我可以修改的设置,以便在上面的示例中仅插入 4 个空格?
更新
选项卡间距似乎受上面的行的影响。请看下面的动画。如果我的变量赋值行上方有一个带有花括号的方法,则按 Tab 键会达到我的预期并插入 4 个空格。
下面是 TypeScript 文件的一个子集以供参考。如果您注释掉product$
andpipe
函数,则制表符会插入我期望的空格数。
import { catchError, tap, map } from 'rxjs/operators';
export class ProductService {
productsWithCategory$;
productsUrl;
// comment out starting on the line below
products$ = this.http.get<Product[]>(this.productsUrl)
.pipe(
tap(data => console.log('Products: ', JSON.stringify(data))),
catchError(this.handleError)
);
// to here
selectedProduct$ = this.productsWithCategory$
}
解决方案
推荐阅读
- python - 在任务调度程序中自动化我的 python 脚本之后。从 URL 链接获取数据时出错
- python - 出现此错误的未知原因
- angular - Angular + Bootstrap(网格)+ 组件
- reactjs - 刷新时反应路由器黑屏
- kotlin - 如何检查类属性是否是 Kotlin 中的 List 类型
- javascript - 即使刷新页面,如何使我的购物车项目仍然存在?
- android - 使用 Firebase 远程配置将用户列入功能标志白名单的最佳方式?
- vue.js - 在 Vuetify 数据表中,如何访问选定的排序参数?
- reactjs - react-testing-library 的 fireEvent.click 在测试 react-native-web 时未更新 debug() 的结果
- docker - 如何暴露 docker 容器端口并从邮递员调用?