Vscode: Auto import quotes sign should be configured by tslint.json for Typescript

Created on 29 Mar 2017  路  7Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.10.2
  • OS Version: windows 10

Steps to Reproduce:

  1. add to tslint.json
{"rules": {
 "quotemark": [true, "single"],
}}
  1. Add to a.ts
    export const a = 1;
  2. Add to b.ts
    a
  3. Click on auto suggestion, then import
  4. See imported string with tslint warning about double quotes

Expect:
import with single quotes with no warning

javascript typescript upstream

Most helpful comment

As @adyavanapalli very well mentioned, you can edit the _typescript.json_ file to get around this issue on /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/snippets/ for MacOS and C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\typescript\snippets\ for Windows.

Thx buddy.

All 7 comments

Alternatively, it could check for other imports and use the quote style those do. Perhaps read .editorconfig

I'm really interested in this getting fixed up, but it looks like it's a dup of #21424, which itself was closed as being tracked by Microsoft/TypeScript#13270.

Yes, thanks @devrelm. This is a duplicate of Microsoft/TypeScript#13270 and really should be fixed upstream on the TypeScript side

As @adyavanapalli very well mentioned, you can edit the _typescript.json_ file to get around this issue on /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/snippets/ for MacOS and C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\typescript\snippets\ for Windows.

Thx buddy.

adding "prettier.singleQuote":true, did the trick for me

Howdy @cengkuru ... where did you add prettier.singleQuote? Seems unrecognized in VS user settings. Thx!

@bjareczek I presume it is a plugin to the VS/VSC

Was this page helpful?
0 / 5 - 0 ratings