question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[html-templating] easy way to inherite advanced html features

See original GitHub issue

With the vscode extension Better Jinja the jinja-html language highlights jinja html templates, however some more advanced features available with the html langauge are not working with jinja-html:

  • highlighting the opening tag when the cursor is in the closing tag (and visa versa) image image In the second case with jinja-html as the language all divs are highlighted, not just the sibling of the tag under the cursor
  • auto creating the closing tag once the opening tag is created.

And probably more, but these are the two which would be most useful.

How do I get these advanced features working in my child language definition?

I’ve tried copying most of the config from extensions/html/package.json and extensions/html/language-configuration.json into my extension but to no avail. I also tried looking through extensions/html-language-features but there’s nothing obvious there to include.

This isn’t as simple as adding more file extensions somewhere, even in a .html file if the language is changed to jinja-html the features above disappear.

  • VSCode Version: 1.22.2 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9 x64
  • OS Version: ubuntu 18.04

Steps to Reproduce:

  1. install “Better Jinja”
  2. open or create a file with some html in
  3. change the language to jinja-html
  4. try using advanced html features as described above

Does this issue occur when all extensions are disabled?: Yes (the advanced features work with the html language without extensions, obviously the error can only be shown with the extension installed)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
boonpraserdcommented, Apr 21, 2020

When I used “Better Jinja”, I also used “Auto Close Tag” extension to solve this problem. Please don’t forget to edit settings.json by add “jinja-html” to “auto-close-tag.activationOnLanguage”.

0reactions
angelozerrcommented, Apr 4, 2022

@aeschli many thanks for your answer I created the PR at https://github.com/microsoft/vscode/pull/146731

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template Inheritance in Flask - GeeksforGeeks
Lets define the common structure of web pages in base.html file. First of all we will render template using flask from main.py file...
Read more >
Pug HTML Template Engine: A Beginner's Guide - SitePoint
Pug is a preprocessor that speeds up writing HTML. Learn the syntax and features by building a simple Node project with Pug.
Read more >
Template Inheritance | Smarty
Instead of using the {extends} tags in the template files you can define the whole template inheritance tree in the PHP script when...
Read more >
HTML and CSS Tutorial - Nanyang Technological University
HTML is a Document Description Language (aka Document Markup Language). HTML is the standard markup language for documents designed to be displayed in...
Read more >
Template Inheritance - Pug
To extend this layout, create a new file and use the extends directive with a path to the parent template. (If no file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found