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

Extension should not activate in normal HTML. #21

Open
Kiiyya opened this issue Aug 26, 2021 · 1 comment
Open

Extension should not activate in normal HTML. #21

Kiiyya opened this issue Aug 26, 2021 · 1 comment

Comments

@Kiiyya
Copy link

Kiiyya commented Aug 26, 2021

A bit related to issue #15.

What I did:
I am editing a normal HTML file, which is not a template.
I press CTRL-/ to create a comment.
As a result, I get a Tera comment, not a HTML comment. This is bad.
I look at the langauge in VSCode, and it is "HTML".

My problems:

  1. The langauge in VSCode shows "HTML".
  2. It is not possible to choose "Vanilla HTML", as now Tera HTML claims the "HTML" language in the language chooser. The only option is to disable the whole Tera extension.

Solutions I recommend:

  1. Do not touch the "HTML" language option in the language picker, and instead add a "HTML (Tera)" language option.
  2. Make the "HTML (Tera)" language option auto-activate only when the file extension is foo.html.tera or something like that.

Would be cool, thanks for making this extension :).

@robgering
Copy link

An alternative viewpoint: please do not change the current behavior of the extension (or, if you do make this change, please allow the user to disable it and use the old behavior).

Here's why:

In VSCode, templating languages that aren't built-in to the editor do not have all the intellisense and auto-formatting features present in the HTML language type. This is a longstanding issue with the editor, and does not seem to be a high priority for the team to fix. See: microsoft/vscode#41066, microsoft/vscode#53462

Although Emmet can be enabled for alternative templating languages, hover documentation and automatic formatting (for example, pressing "enter" between two tags to get an added newline and proper indentation) do not work. Try this out in any other templating extension with its own filetype to see what I mean (Better Jinja, ERB, etc).

The choice to extend the HTML language instead of creating a new language type is shared with a popular Hugo extension, and I think it's the correct decision. If you want to use HTML-style comments (for example, while working on plain HTML files), you could just disable the Tera extension temporarily.

If I have to choose between using HTML-style comments and using intellisense and automatic indentation, I would much rather choose the latter!

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

2 participants