Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: VSCode fails to format pug files with [email protected] and higher #478

Open
2 of 7 tasks
ladown opened this issue Jan 15, 2024 · 4 comments
Open
2 of 7 tasks

Comments

@ladown
Copy link

ladown commented Jan 15, 2024

Plugin Version

v3.0.0

Prettier Version

v3.1.1

Which frameworks are affected?

  • none
  • vue
  • angular
  • svelte

Node Version

v20.10.0

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Prettier config

{
  "plugins": ["@prettier/plugin-pug"],
  "tabWidth": 4,
  "singleQuote": true,
  "trailingComma": "all",
  "semi": true,
  "printWidth": 130,
  "useTabs": true,
  "jsxSingleQuote": true,
  "endOfLine": "auto",
  "bracketSameLine": false,
  "htmlWhitespaceSensitivity": "ignore",
  "pugAttributeSeparator": "none",
  "pugWrapAttributesThreshold": 1
}

Input

script.
  const obj = { test: 1};

Output or Error

There is no formatter for 'jade' files installed.

Expected Output

script.
  const obj = { test: 1 };

Additional Context

Hello!

I faced with the problem, that [email protected] and higher causes the problem, that VSCode doesn't format Pug files with prettier. If we install prettier3.1.0 and lower it works fine. When we install [email protected] and higher, we see next indicator in footer panel of VSCode:

image

When we try to format it with command Format Document, we will have the following notification:

image

I also tried to set default formatter in VSCode settings and it didn't not help me.

If we try to format .pug files from CLI, it works perfect

@ladown ladown changed the title Bug: Bug: VSCode fails to format pug files with [email protected] and higher Jan 15, 2024
@Shinigami92
Copy link
Member

Can you identify if this is an issue with the plugin, or maybe with the prettier version https://github.com/prettier/prettier/blob/main/CHANGELOG.md#311

@ladown
Copy link
Author

ladown commented Jan 15, 2024

I tested this issue with other plugins and figured out, that its connected with the Prettier

@mhabsaoui
Copy link

mhabsaoui commented Feb 16, 2024

Hi,
Same here, I have installed Prettier and the Pug plugin as DevDeps.
"@prettier/plugin-pug": "^3.0.0"
"prettier": "^3.2.5"

When trying to indent, I get same suggestion window from VSCode for Jade :-/

Screenshot from 2024-02-16 20-01-14

PS:

  • Linux Ubuntu OS
  • Pug view using the template engine integrated to Express NodeJs

@ladown
Copy link
Author

ladown commented Feb 19, 2024

Hello, @mhabsaoui !

Its a problem with prettier extension as i can see. Here you can learn more - prettier/prettier-vscode#3253

As for me, i found a solution to add path to prettier config in VSCode JSON settings -- "prettier.configPath": "./.prettierrc"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants