Search code examples
editorvscode-extensionsvisual-studio-codevscode-tasks

VS Code Multiple Language highlighters for different languages in one File


First of all, I have just migrated to VS Code for Sublime Text couple of days back.

what I want is to Multiple Language highlighters in one Language extension.

eg: I want to highlight the proper ending tags of HTML,PHP and Javascript inside .php file.

The only method I could find out was in the settings I added this following code:

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

When I tried this the .php file only highlights the HTML syntax.

So is there any extension or any other way of achieving the result I want.?


Solution

  • I have found a long way (always welcomes a better answers)

    The only way I came across is to change the language according to our need using shortcuts and after working change it back.

    eg:

    If we are working on .php file and you have to check the html syntax then.

    Click - ctrl+K and after a little time click - M

    this will bring a Search Bar just type the language you need in my case, html and this will make the default language html so html syntax highlighting will work fine after working you can do the same and change it back.

    This can be done other way, just click on the language(PHP) you see at the bottom of the VS code editor then the Search Bar will come and then follow the steps above.

    Hoping this would be Helpful for you.'

    One more time - a better answer is always welcome