VS Code在一个文件中使用多种语言的荧光笔 [英] VS Code Multiple Language highlighters in one File

查看:292
本文介绍了VS Code在一个文件中使用多种语言的荧光笔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,几天前我刚迁移到 VS Code 以获得 Sublime Text .

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.

例如:我要突出显示.php文件中HTMLPHPJavascript的正确结束标签.

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"
 }

当我尝试此操作时,.php文件仅突出显示HTML语法.

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.?

推荐答案

我已经找到了很长的路要走 (总是欢迎一个更好的答案)

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.

例如:

如果我们正在处理.php文件,则必须检查html语法.

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

单击- ctrl + K ,过一会儿再单击- M

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

这将带来一个搜索栏,只需输入我需要的语言html,这将成为默认语言html,因此html语法突出显示将在工作后正常运行您可以执行相同操作,然后将其改回.

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.

这可以通过其他方式完成,只需单击在VS code editor底部看到的language(PHP),然后出现搜索栏,然后按照上述步骤操作.

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.

希望这对您有帮助.'

再说一次-总是欢迎一个更好的答案

One more time - a better answer is always welcome

这篇关于VS Code在一个文件中使用多种语言的荧光笔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆