After installing the Django plug-in in VSCode, realize html syntax prompt

1 Default html syntax prompt in VSCode

VSCode (1.64) automatically adds HTML syntax prompts after the default installation is complete, but after installing the Django plug-in, the automatic syntax prompts for html files in the Django project file become django-html syntax, and the original html syntax prompts are gone.

insert image description here
insert image description here

2 The first method: directly modify the relevant options in the "Settings"

After the Django plug-in is installed, in order to restore the original html syntax prompt and retain the django-html syntax prompt
, you need to set the corresponding properties in VSCode, open the settings in VSCode, enter file association in the search box above, and configure the file association properties accordingly
insert image description here
in Files: Add items in the added items under Associations
insert image description here
After adding the above options, add the Emmet syntax abbreviation prompt.
insert image description here
After the above two steps, you can have both HTML syntax prompts and HTML syntax prompts when writing html files in the Django template file django-html syntax hints.

3 The second method: configure in the setting.json file

The above two steps are relatively cumbersome, and you can also directly modify the setting.json file of VSCode to achieve the above effect.
Open the settings, click "Open Settings (json)" in the upper right corner
insert image description here
to add the following settings:

"files.associations": {
        "**/*.html": "html",
        "**/templates/**/*.html": "django-html",
    },
    "emmet.includeLanguages": {
        "django-html": "html"
    },

insert image description here

Guess you like

Origin blog.csdn.net/gandongusa/article/details/123049993