Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable code formatting #2

Closed
jsnjack opened this issue Jun 22, 2016 · 4 comments
Closed

Disable code formatting #2

jsnjack opened this issue Jun 22, 2016 · 4 comments

Comments

@jsnjack
Copy link

jsnjack commented Jun 22, 2016

If I have following code in the editor:

{% if something %}
    {% if nothing %}
        <a>A</a>
    {% endif %}
{% endif %}

and I save the file, it reformats it to:

{% if something %} {% if nothing %}
<a>A</a> {% endif %} {% endif %}
@jsnjack
Copy link
Author

jsnjack commented Jun 22, 2016

I also use this extension https://github.com/Lonefy/vscode-JS-CSS-HTML-formatter . I think, for some reason it treats jinja template as html file

@wholroyd
Copy link
Owner

The extension I made only provides colorization of the Jinja templating components. It does inherit from the HTML language as to provide support for Jinja when used with HTML, so other extensions can affect the same document. If anything is reformatting the file, it's not from my extension.

It does appear that the extension you mentioned does attempt to format the file when saving. There is a method defined in that project's README to disable that feature if it's causing problems. It appears the feature is relatively new as well, only about a month old - Lonefy/vscode-JS-CSS-HTML-formatter#4

@jsnjack
Copy link
Author

jsnjack commented Jun 24, 2016

Thank you! I already disabled formatting on save, but it would probably be nice to have it for js and html files (jinja files should be left intact). I will create an issue in the formatter repository

@jsnjack jsnjack closed this as completed Jun 24, 2016
@linanwx
Copy link

linanwx commented Feb 10, 2017

After install JS-CSS-HTML Formatter, you should edit this line in formatter.json.
"onSave": true, --> "onSave": false,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants