嗨,正如标题所暗示的,我如何忽略我的.php文件上的SQL语法高亮?
正如您在上图中看到的那样,Visual Studio Code似乎认为'DELETE /api/crm/contact_meetings....'
启动了一个SQL查询并混淆了整个文件的突出显示。
我已经尝试检查Visual Studio代码设置但无济于事,我似乎无法找到它的相关配置条目。
只是想注意,我也用关键字DELETE来体验这一点。这个关键字肯定存在一些问题。
到目前为止,我的调查使我相信它既可以是语言问题,也可以是主题特定问题。
PHP的语言语法突出显示规则取自Atom的定义 - 请参见此处:https://github.com/atom/language-php/blob/master/grammars/php.cson和https://github.com/atom/language-php/issues/321
Visual Studio Code通过php.tmLanguage.json
实现了这一点,你可以在~\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\php\syntaxes
找到它。
或者,它是一个主题特定的东西,可能在这里~\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\theme-defaults\themes
。
VS Code团队表示,应针对原始存储库(上面链接)解决任何贡献或问题。我已经决定不值得花时间进一步调查,但欢迎您尝试在那里提出问题:)
如果您碰巧找到了解决方案,请告诉我!
我有同样的问题,我在蜡笔的帖子的帮助下修复它。
只需删除这些行!
〜\ AppData \ Local \ Programs \ Microsoft VS Code \ resources \ app \ extensions \ php \ syntaxes \ php.tmLanguage.json
2531: "sql-string-double-quoted": {
2532: "begin": "\"\\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|AND)\\b)",
2533: "beginCaptures": {
2534: "0": {
2535: "name": "punctuation.definition.string.begin.php"
2536: }
2537: },
2538: "contentName": "source.sql.embedded.php",
2539: "end": "\"",
2540: "endCaptures": {
2541: "0": {
2542: "name": "punctuation.definition.string.end.php"
2543: }
2544: },
2545: "name": "string.quoted.double.sql.php",
2546: "patterns": [
2547: {
2548: "include": "source.sql"
2549: }
2550: ]
2551: },
2552: "sql-string-single-quoted": {
2553: "begin": "'\\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|AND)\\b)",
2554: "beginCaptures": {
2555: "0": {
2556: "name": "punctuation.definition.string.begin.php"
2557: }
2558: },
2559: "contentName": "source.sql.embedded.php",
2560: "end": "'",
2561: "endCaptures": {
2562: "0": {
2563: "name": "punctuation.definition.string.end.php"
2564: }
2565: },
2566: "name": "string.quoted.single.sql.php",
2567: "patterns": [
2568: {
2569: "include": "source.sql"
2570: }
2571: ]
2572: },
我必须把它作为对Crayons帖子的评论添加,但我不能,因为我对这里完全是新手。抱歉。希望它能帮到你。