How to auto complete HTML in . tpl files in Vscode?

Asked

Viewed 227 times

1

In my project to redenrize my views, I am using Smarty, in which your files are from the extension .tpl. In these files, I write 80% in HTML, but it is becoming a tiresome and slow work, because Vscode does not give the option to auto complete my tags.

Is there any extension or configuration possible for this?

  • Related: https://answall.com/questions/456897/vs-code-n%C3%A3o-autocomplete-tags-html-ou-css-em-uma-Blade-Laravel

  • Related: https://answall.com/questions/287219/howto use shortcuts-do-bootstrap-no-vscode-em-arquivos-blade?rq=1

1 answer

1


One of the options is you include a specific configuration in your file settings.json. There are two ways you can do this.

Accessing the VS CODE "Preferences" screen

To access VS Code preferences, you must use the shortcut CTRL+, (in my OS is this shortcut, it may vary in others). You can also use the menu: File > Preferences > Settings.

When opening the configuration screen, you need to type "files.Associations" and add a value in "Item" and "Value". The values are respectively, *.tpl and html, as shown in the image:

Adicionando configuração específica no VS CODE

Editing the settings.json directly

If you prefer to edit the file settings.json, you must click on the icon acíma, located on the right, called "Open Settings (json)".

Ícone de edição do settings.json do VS CODE

Then add the line:

    "files.associations": {
        "*.tpl": "html"
    },

Upshot

After doing so, by typing any code into a file .tpl, you will get an autocomplete as follows:

Configurando autocomplete de HTML em outra linguagem

  • 1

    Wallace, thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.