Comments (7)
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.
@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.
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.
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.
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.
I do!😊. I will probably start to take a look at from tomorrow's on.
from heex_formatter.
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)
- HTML comments produce unexpected nesting HOT 3
- Sponsorship of project HOT 1
- Syntax error for <div> HOT 2
- Single-line `~H` receives an unwanted newline HOT 4
- ArgumentError while formatting Unicode text HOT 2
- Unable to run mix deps.get HOT 1
- Stripping parentheses from anonymous function HOT 4
- Extra line breaks on <button> with no text content HOT 1
- Lining up of closing brackets in self-closing/void element HOT 5
- case's `end` block terminator shifts when last clause is empty
- mix formats removes intentional single blanks HOT 2
- additional new lines above and below HTML comment tags every time formatter is run HOT 2
- Whitespace lost when removing newlines HOT 1
- Failing to format consecutive embedded Elixir tags in a style tag HOT 1
- Formatting remove spaces between `Text <tag>` to `Text<tag>` HOT 4
- Formatter adds space around nested dynamic content, breaking :empty css pseudoclass HOT 2
- Space was add to content in script tag HOT 1
- Negative indentation error after assigning a var inside an HTML tag HOT 2
- Elixir code inside elixir expression tag with do block is not formatted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heex_formatter.