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

Formatting issue with "evenBetterToml.formatter.indentTables": true #363

Closed
lsorber opened this issue Dec 16, 2022 · 7 comments
Closed

Formatting issue with "evenBetterToml.formatter.indentTables": true #363

lsorber opened this issue Dec 16, 2022 · 7 comments

Comments

@lsorber
Copy link

lsorber commented Dec 16, 2022

With the default configuration + "evenBetterToml.formatter.indentTables": true, this example is formatted nicely:

[tool.poe.tasks] # https://github.com/nat-n/poethepoet

  [tool.poe.tasks.dev]
  help = "Serve a REST API in development"
  cmd = """
    uvicorn
      --host 0.0.0.0
      --port $port
      --reload
      my_package.api:app
    """

  [tool.poe.tasks.docs]
  help = "Generate this package's docs"
  cmd = """
      pdoc
        --docformat $docformat
        --output-directory $outputdirectory
        my_package
      """

However, adding arguments to the first Poe task causes the second Poe task to be unindented:

[tool.poe.tasks] # https://github.com/nat-n/poethepoet

  [tool.poe.tasks.dev]
  help = "Serve a REST API in development"
  cmd = """
    uvicorn
      --host 0.0.0.0
      --port $port
      --reload
      my_package.api:app
    """

    [[tool.poe.tasks.dev.args]] # <-- New compared to previous example
    help = "Bind socket to this port (default: 8000)"
    name = "port"
    options = ["--port"]
    default = "8000"

[tool.poe.tasks.docs] # <-- Unindented :-(
help = "Generate this package's docs"
cmd = """
      pdoc
        --docformat $docformat
        --output-directory $outputdirectory
        my_package
      """

Is this a bug, or intended? Is there a solution or workaround?

@lsorber
Copy link
Author

lsorber commented Dec 19, 2022

Another issue I just noticed: in the first example, the two cmd = """ are not horizontally aligned.

@sondrfos
Copy link

We are experiencing the same bug, would love if it was addressed :)

@Eutropios
Copy link

Can confirm that this bug is still occurring:

[tool.poetry]
    # ...
    version = "0.0.5"
    [tool.poetry.dependencies]
        python  = ">=3.8,<3.13"
        urllib3 = "^2.0.4"
    [tool.poetry.group.dev]
        optional = true
        [tool.poetry.group.dev.dependencies]
            pipdeptree = "^2.13"
            vermin     = "^1.6"
            viztracer  = ">=0.16,<1"
[tool.poetry.group.docs]
    optional = true
    [tool.poetry.group.docs.dependencies]
        esbonio = "*"
        furo = ">=2023.9"
        sphinx = [ # 6 is lower bound because of furo
            {version = ">=6,<7.2", python = "~3.8"},
            {version = ">=6,<8", python = ">=3.9,<3.13"},
        ]
        sphinx-copybutton = ">=0.5.2,<1"
        sphinx-inline-tabs = ">=2023.4.21"
        sphinx-lint = "*"
        sphinx-notfound-page = "^1"
        sphinx_last_updated_by_git = ">=0.3.6,<1"

@JounQin
Copy link
Collaborator

JounQin commented Feb 19, 2024

PR welcome for a fix

@ia0
Copy link
Collaborator

ia0 commented Feb 19, 2024

This has been fixed by #450 and should have been released by now. Which version are you using?

With the following taplo.toml:

[formatting]
indent_tables = true
indent_string = "    "

I get the following indentation:

[tool.poetry]
# ...
version = "0.0.5"
    [tool.poetry.dependencies]
    python = ">=3.8,<3.13"
    urllib3 = "^2.0.4"
    [tool.poetry.group.dev]
    optional = true
        [tool.poetry.group.dev.dependencies]
        pipdeptree = "^2.13"
        vermin = "^1.6"
        viztracer = ">=0.16,<1"
    [tool.poetry.group.docs]
    optional = true
        [tool.poetry.group.docs.dependencies]
        esbonio = "*"
        furo = ">=2023.9"
        sphinx = [ # 6 is lower bound because of furo
            { version = ">=6,<7.2", python = "~3.8" },
            { version = ">=6,<8", python = ">=3.9,<3.13" },
        ]
        sphinx-copybutton = ">=0.5.2,<1"
        sphinx-inline-tabs = ">=2023.4.21"
        sphinx-lint = "*"
        sphinx-notfound-page = "^1"
        sphinx_last_updated_by_git = ">=0.3.6,<1"

@ia0 ia0 closed this as completed Feb 19, 2024
@Eutropios
Copy link

This has been fixed by #450 and should have been released by now. Which version are you using?

With the following taplo.toml:

[formatting]
indent_tables = true
indent_string = "    "

I get the following indentation:

[tool.poetry]
# ...
version = "0.0.5"
    [tool.poetry.dependencies]
    python = ">=3.8,<3.13"
    urllib3 = "^2.0.4"
    [tool.poetry.group.dev]
    optional = true
        [tool.poetry.group.dev.dependencies]
        pipdeptree = "^2.13"
        vermin = "^1.6"
        viztracer = ">=0.16,<1"
    [tool.poetry.group.docs]
    optional = true
        [tool.poetry.group.docs.dependencies]
        esbonio = "*"
        furo = ">=2023.9"
        sphinx = [ # 6 is lower bound because of furo
            { version = ">=6,<7.2", python = "~3.8" },
            { version = ">=6,<8", python = ">=3.9,<3.13" },
        ]
        sphinx-copybutton = ">=0.5.2,<1"
        sphinx-inline-tabs = ">=2023.4.21"
        sphinx-lint = "*"
        sphinx-notfound-page = "^1"
        sphinx_last_updated_by_git = ">=0.3.6,<1"

Hi, I'm using 0.19.2 of the VSCode extension.
Even when reducing the config down to only those two options, the second entry isn't indented.

{
    ...,
    "evenBetterToml.formatter.indentString": "    ",
    "evenBetterToml.formatter.indentTables": true,
    ....,
}

I took a look at the extension on the market place, and it was last updated prior to the release that fixes this issue. Maybe that's the source of the problem?

@ia0
Copy link
Collaborator

ia0 commented Feb 20, 2024

I took a look at the extension on the market place, and it was last updated prior to the release that fixes this issue. Maybe that's the source of the problem?

That's correct. You'll need the new version that's in the works. Not sure which issue you can follow best for that, probably #547 although it's a merged PR.

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

5 participants