如何在 Visual Studio Code 中使用 TypeScript 和 JavaScript 禁用自动导入的自动分号? [英] How to disable automatic semicolon for auto imports with TypeScript and JavaScript in Visual Studio Code?

查看:19
本文介绍了如何在 Visual Studio Code 中使用 TypeScript 和 JavaScript 禁用自动导入的自动分号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 VS Code 和 Typescript 或 JavaScript 时,VS Code 建议自动导入.但是当自动插入导入时,它会在行尾添加一个分号.我不想要这个分号.此外,它在我的 tslint 中也是如此配置的.

When working with VS Code and Typescript or JavaScript, VS Code suggests auto imports. But when inserting the import automatically, it will add a semicolon at the end of the line. I do not want this semicolon. In addition, it is configured in my tslint as such.

有没有办法告诉 VS Code 不要插入这个分号?

Is there anyway to tell VS Code to not to insert this semicolon?

推荐答案

目前没有办法做到这一点,对于 VSCode 1.30.2、TypeScript 3.3.

There is no way of doing that at the moment, for VSCode 1.30.2, TypeScript 3.3.

您可以在此处查看功能请求:https://github.com/Microsoft/TypeScript/issues/19882

You can check out the feature request here: https://github.com/Microsoft/TypeScript/issues/19882

但此功能可能会在 TypeScript 3.4 中出现,因为@RyanCavanaugh 将里程碑更新为 3.4

But this feature may come in TypeScript 3.4, as @RyanCavanaugh updated the milestone to 3.4

同时,我使用semi-standard风格.

此外,纯 standard 样式在 VSCode 中效果不佳,因为对齐方式混乱:

Also, pure standard style does not work well in VSCode as the alignment is messed up:

function foo() {
  const x = {}

    ;['a'].map(x => console.log(x)) // <-- alignment is bad
}

这篇关于如何在 Visual Studio Code 中使用 TypeScript 和 JavaScript 禁用自动导入的自动分号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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