sanusart / atom-wrap-in-tag

Simplest package for Atom editor that wraps HTML tag around selection
https://atom.io/packages/atom-wrap-in-tag
MIT License
73 stars 9 forks source link

Work with block elements #3

Open pdxwolfy opened 8 years ago

pdxwolfy commented 8 years ago

I'd like to see this work cleanly with multi-line elements. That is, it should change this:

    <p>
      blah blah blah
    </p>

to:

   <div>
     <p>
       blah blah blah
     </p>
   </div>

when the 3 lines are selected and you type

. Right now, it just kind of makes a mess of things:

      <div>    <p>
      blah blah blah
    </p>
 </div>

where the final

is flush left in the file.

sanusart commented 8 years ago

Should we format the code block automatically? I am not sure, some users may disagree that this should happen automatically maybe a check box in the settings?

On Mon, Dec 28, 2015, 4:40 AM pdxwolfy notifications@github.com wrote:

I'd like to see this work cleanly with multi-line elements That is, it should change this:

<p>
  blah blah blah
</p>

to:

blah blah blah

when the 3 lines are selected and you type Right now, it just kind of makes a mess of things:

  <div>    <p>
  blah blah blah
</p>

where the final is flush left in the file

— Reply to this email directly or view it on GitHub https://github.com/sanusart/atom-wrap-in-tag/issues/3.

pdxwolfy commented 8 years ago

Thanks for the response. You probably know your users better than I do, but I wouldn't object to a configurable check box. As for formatting, that would probably depend on how hard it would be. I'd be happy if wrapping complete lines of text simply just put the tags above and below the selected block, preferably at the original indentation. Whether it indents the wrapped text any further is less important (auto indent may already do that if it is on).

sanusart commented 8 years ago

No built-in auto indent in atom as far as I know, to keep core as small as possible or to let users choose their tools I guess.

On Mon, Dec 28, 2015, 7:19 AM pdxwolfy notifications@github.com wrote:

Thanks for the response. You probably know your users better than I do, but I wouldn't object to a configurable check box. As for formatting, that would probably depend on how hard it would be. I'd be happy if wrapping complete lines of text simply just put the tags above and below the selected block, preferably at the original indentation. Whether it indents the wrapped text any further is less important (auto indent may already do that if it is on).

— Reply to this email directly or view it on GitHub https://github.com/sanusart/atom-wrap-in-tag/issues/3#issuecomment-167486612 .

pdxwolfy commented 8 years ago

Auto Indent on Paste is one of the core settings.

sanusart commented 8 years ago

Oh, cool. I'll check it out.

On Mon, Dec 28, 2015, 7:39 AM pdxwolfy notifications@github.com wrote:

Auto Indent on Paste is one of the core settings.

— Reply to this email directly or view it on GitHub https://github.com/sanusart/atom-wrap-in-tag/issues/3#issuecomment-167489699 .

cworf commented 7 years ago

I would like to voice my agreement for a feature like this, I love this plugin by the way, not sure why its not a native function of atom!

littlebee commented 6 years ago

It seems like you could just indent the selected block of lines and put the wrapper tag and closing tag at the least most indentation previously used by the block?

I think that's how this other atom package does it. The other package has the flaw that it doesn't stop editing both tags on space and I constantly have to backup and hit escape twice before adding attributes.