daaain / daaain/Handlebars

Reindent functionality doesn't work inside templates

Open
#45 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
303
Forks
48
PR merge metrics
No merged PRs in 30d

Description

When using this plugin, or the standard html plugin, "reindent" functionality does not work inside script blocks. For example, in the example code below, using "reindent" on any of the opening or closing div tags does not move the tag out. Reindent on a large block of template markup just flattens it out to the same level as the script tag.

<html>
   <script type="text/x-handlebars" data-template-name="test">

   <div>
   <div>
   </div>
   </div>

   </script>
</html>

This is pretty critical for users for the sublemacspro (emacs keybindings), as tab is defaulted to reindent to match emacs functionality. If you have any thoughts on what the solution is I might be able to look into the fix, I just don't really know where to get started.

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

Start by reproducing the example in this issue with the Handlebars and standard HTML plugins, then trace the reindent handling for script blocks. The fix is complete when reindenting nested div tags preserves their nesting and moves them correctly relative to the script tag; add a regression test if the project has an existing test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars, javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.