Git Product home page Git Product logo

Comments (7)

03juan avatar 03juan commented on July 28, 2024 1

Unfortunately it's stripping out the comments from the original code and now is also inserting an indented blank line

<div>
  
</div>

from heex_formatter.

josevalim avatar josevalim commented on July 28, 2024 1

@feliperenan we need to call Code.string_to_quoted_with_comments and then pass the :comments option in Code.quoted_to_algebra. (This is separate from the original issue).

from heex_formatter.

feliperenan avatar feliperenan commented on July 28, 2024 1

The main issue is now fixed on main but depends on Elixir 1.14 that is yet to be released.

PS: You should comment your code using <%!-- comment --%> syntax because <%# comment %> will be deprecated soon. The previous work around should work.

from heex_formatter.

feliperenan avatar feliperenan commented on July 28, 2024

Hi @mulias

Thanks for reporting this. I'm working in a refactor to use Inspect.Algebra module to format the code. Hopefully this issue will be solved once I'm done with that.

from heex_formatter.

josevalim avatar josevalim commented on July 28, 2024

This will have to be fixed in Elixir and therefore wait for a new Elixir version. :(

@feliperenan let me know if you want to contribute this feature upstream!

from heex_formatter.

feliperenan avatar feliperenan commented on July 28, 2024

I do!😊. I will probably start to take a look at from tomorrow's on.

from heex_formatter.

mulias avatar mulias commented on July 28, 2024

Quick update, since my initial description is no longer correct

case 1 input:

    <div>
      <%# some %>
      <%# comment %>
      <%# lines %>
    </div>

output:

  <div>
    
  </div>

case 2 input:

    <div>
      <% # some %>
      <% # comment %>
      <% # lines %>
    </div>

output:

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

case 3 input:

    <div>
      <%= # some %>
      <%= # comment %>
      <%= # lines %>
    </div>

output:

  <div>
    <%=  %>
    <%=  %>
    <%=  %>
  </div>

The workaround mentioned above no longer works, but everything else seems to be working great!

from heex_formatter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.