ronnidc / vscode-nunjucks

Nunjucks for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ronnidc.nunjucks
65 stars 18 forks source link

Is it possible to turn on html-like formatting in Nunjucks? #12

Open Seminioni opened 7 years ago

Seminioni commented 7 years ago

Hi! I am using your extension together with nunjucks templates, but I've got an issue: VS CODE does not format nunjucks templates (at all) because of I use nunjucks syntax (look at the pic). Pic1 On the other hand if I use html syntax highlighting then VS CODE does your job great, except one thing (look at the pic). Pic2

Everything great except FUCKING comments formatting OMG. I just wanna them not to be formatted! Is it possible to fix it?

Syntax Comments
Nunjucks syntax Everything fine and great except formatting. It's just doesnt work with this syntax.
Html Syntax Syntax highlighting of nunjucks templates doesnt work. Formatting works, but nunjucks comments merge into one line.
york-xtrem commented 7 years ago

The same happens to me. It isn't a problem of this extension but if someone has a solution that is welcome!

{# Nunjucks Templating!
  Homepage: https://mozilla.github.io/nunjucks/
  Docs: https://mozilla.github.io/nunjucks/api.html
#}
{% extends 'layouts/application.html' %}

{% block head %}
<title>Prueba</title>
{% endblock %}

{% block content %}
<h1 data-module="example">{{ autor }}</h1>
{% endblock %}

After formatting:


{# Nunjucks Templating! Homepage: https://mozilla.github.io/nunjucks/ Docs: https://mozilla.github.io/nunjucks/api.html #}
{% extends 'layouts/application.html' %} {% block head %}
<title>Prueba</title>
{% endblock %} {% block content %}
<h1 data-module="example">{{ autor }}</h1>
{% endblock %}
see311 commented 6 years ago

how to add the formatter for 'nunjucks'-files?

jeffreymeng commented 6 years ago

Honestly, if you just added html formatting to this extension, at least you could get some basic html formatting with nunjucks.

cannap commented 6 years ago

i use

https://marketplace.visualstudio.com/items?itemName=mblode.twig-language-2 and added this settings

  "files.associations": {
    "*.svg": "html",
    "*.njk": "twig"
  },

it works very well yea i did not testing everything https://www.useloom.com/share/73951077b70d4c67a789b8297ee3baf7