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: indentation issues with pugExplicitDiv and pugClassNotation=attribute #405

Closed
2 of 7 tasks
sheoak opened this issue Jul 19, 2022 · 0 comments · Fixed by #407
Closed
2 of 7 tasks

Bug: indentation issues with pugExplicitDiv and pugClassNotation=attribute #405

sheoak opened this issue Jul 19, 2022 · 0 comments · Fixed by #407
Assignees
Labels
framework: Vue Related to the framework Vue type: bug Functionality that does not work as intended/expected

Comments

@sheoak
Copy link

sheoak commented Jul 19, 2022

Plugin Version

v2.1.1

Prettier Version

v2.7.1

Which frameworks are affected?

  • none
  • vue
  • angular
  • svelte

Node Version

v16.16.0

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Prettier config

{
  "trailingComma": "es5",
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true,
  "pugSingleQuote": false,
  "pugAttributeSeparator": "none",
  "pugWrapAttributesThreshold": 1,
  "pugClassNotation": "attribute",
  "pugExplicitDiv": true
}

Input

<template lang="pug">
.test
  .test2
    .test3
      .test4
</template>

Output or Error

div(class="test")
div(class="test2")
  div(class="test3")
    div

Expected Output

div(class="test")
  div(class="test2")
    div(class="test3")
      div

Additional Context

When adding "pugClassNotation": "attribute" option and then reformatting with prettier, the indentation changed.
(In the given example, the second div indentation).

However, if i first add explicit div like that manually, it works as expected:

div.test
  div.test2
    div.test3
      div.test4

Shouldn't "pugClassNotation": "attribute" option enforce "pugExplicitDiv": true and apply it before re-indenting?
I think this is not correct in pug :

(class="test")

but this what I get if I remove "pugExplicitDiv": true option :

Before:
.test

After:
(class="test")

@Shinigami92 Shinigami92 self-assigned this Jul 25, 2022
@Shinigami92 Shinigami92 added type: bug Functionality that does not work as intended/expected framework: Vue Related to the framework Vue labels Jul 25, 2022
@sheoak sheoak changed the title Bug: Bug: indentation issues with pugExplicitDiv and pugClassNotation=attribute Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework: Vue Related to the framework Vue type: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants