question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prettier "prettier.singleQuote" not working in 1.40 vs code

See original GitHub issue

Summary

Prettier “prettier.singleQuote” not working in 1.40 vs code

Github Repository to Reproduce Issue

Steps To Reproduce:

  1. Install VS Code 1.40.1 (user step-up)
  2. Install Prettier add-on to VS Code
  3. Set below settings in VS Code “prettier.singleQuote”: true, “editor.formatOnSave”: true,
  4. Create/Edit a file with below content - file-name.ts
import { Injectable } from '@angular/core';
import { HttpService } from '@app/core/http.service';

@Injectable({
  providedIn: 'root'
})
export class ElementBrowserService {
  constructor(private httpService: HttpService) {}

  public getGroupDetails(supportedType: number) {
    return this.httpService.get<dcGroupDetails[]>(
      `V1/Element/Groups/Type/${supportedType}`,
      null,
      'GetGroupDetails'
    );
  }
}
  1. Save file.

Expected result: File should format with “singleQuotes”

Actual result

File is formatted with double quotes

Additional information

image

image

VS Code Version: Version: 1.40.1 (user setup) Commit: 8795a9889db74563ddd43eb0a897a2384129a619 Date: 2019-11-13T16:49:35.976Z Electron: 6.1.2 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Windows_NT x64 6.1.7601

OS and version:

Windows 7 Enterprise Version 6.1(Build 7601: Service Pack 1)

Prettier Log Output

[INFO - 10:09:39 AM] Extension Name: “prettier-vscode”. [INFO - 10:09:39 AM] Extension Version: “3.9.0”. [INFO - 10:09:39 AM] Enabling prettier for languages: [ “javascript”, “mongo”, “javascriptreact”, “typescript”, “typescriptreact”, “json”, “jsonc”, “json5”, “css”, “postcss”, “less”, “scss”, “graphql”, “markdown”, “mdx”, “html”, “vue”, “yaml” ] [INFO - 10:09:40 AM] Enabling prettier for range supported languages: [ “javascript”, “javascriptreact”, “typescript”, “typescriptreact”, “json”, “graphql” ] [INFO - 10:10:17 AM] Formatting d:\AzureDevOps\Dev\Dev1.0\Web\src\app\widgets\common\element-browser\element-browser.service.ts. [INFO - 10:10:17 AM] Using bundled version of prettier. [INFO - 10:10:17 AM] Resolved ignore file to d:\AzureDevOps\Dev\Dev1.0\Web.prettierignore. [INFO - 10:10:17 AM] File Info: { “ignored”: false, “inferredParser”: “typescript” } [INFO - 10:10:18 AM] Prettier Options: { “filepath”: “d:\AzureDevOps\Dev\Dev1.0\Web\src\app\widgets\common\element-browser\element-browser.service.ts”, “parser”: “typescript”, “useTabs”: false, “tabWidth”: 2 } [INFO - 10:10:18 AM] Formatting completed in 561.919748ms. [INFO - 10:10:26 AM] Formatting d:\AzureDevOps\Dev\Dev1.0\Web\src\app\widgets\common\element-browser\element-browser.service.ts. [INFO - 10:10:26 AM] Using bundled version of prettier. [INFO - 10:10:26 AM] Resolved ignore file to d:\AzureDevOps\Dev\Dev1.0\Web.prettierignore. [INFO - 10:10:26 AM] File Info: { “ignored”: false, “inferredParser”: “typescript” } [INFO - 10:10:26 AM] Prettier Options: { “filepath”: “d:\AzureDevOps\Dev\Dev1.0\Web\src\app\widgets\common\element-browser\element-browser.service.ts”, “parser”: “typescript”, “useTabs”: false, “tabWidth”: 2 } [INFO - 10:10:26 AM] Formatting completed in 42.85524ms.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

46reactions
balintbalazscommented, Nov 26, 2019

@ntotten Thanks for the insight. The Angluar CLI by default adds an .editorconfig file which doesn’t specify the quotes. This basically breaks the fallback to the vscode configuration which caused some confusion. Adding quote_type = single fixed it for me.

7reactions
jpzwartecommented, Nov 26, 2019

I just “fixed” this by adding quote = single to my .editorconfig file in my angular project. Apparently prettier is using .editorconfig over the vscode settings. And the lack of a quote property is causing it to default to the double quote.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode single to double quote automatic replace
A part a green warning ( Unknown configuration setting ) the single quotes are no more replaced. I suspect that the prettier extension...
Read more >
Prettier single quote setting not respected in .tsx files (VS Code)
Problem. I am trying to using single quotes setting in Prettier, however, the formatted keeps double quotes. What the heck is going on?!...
Read more >
Switching to single quotes for attribute completions in html
Use the "HTML › Completion: Attribute Default Value" setting to control if VS Code uses single or double quotes when completing html ...
Read more >
VS Code Prettier Setting: prettier.singleQuote - YouTube
Want to master VS Code ? Click here: https://andrecasal.com/courses/mastery-for-vs-codeWant to upgrade web dev skills?
Read more >
最新趨勢觀測站- prettier single quote的推薦與評價
singleQuote" not working in 1.40 vs code #1099 的評價; prettier single quote 在Switching to single quotes for attribute completions in html 的評價; prettier ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found