mblode / mblode/vscode-twig-language-2

Formatting in inline script tags does not keep indents

Open
#69 6 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

formatter
Dominant language
JavaScript
Stars
62
Forks
33
PR merge metrics
No merged PRs in 30d

Description

I have some problem with the formatting when I have an inline script tag.
When I have this in my file:

<div>
    <script>
        const myVar = "test;
        if(myVar == 'test'){
            console.log("hello");
        }
    </script>
</div>

I get this:

<div>
    <script>
const myVar = "test;
if(myVar == 'test'){
console.log("hello");
}
    </script>
</div>

So the script tags stay on the correct indentation. But everything between the tags loses all indentation.
Am I the only one?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported formatting behavior using the inline script example in the issue, then trace the extension's formatter entry point. Done means the script contents retain their indentation relative to the surrounding script tag while the tags themselves remain correctly indented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.