吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2970|回复: 18
收起左侧

[其他原创] vscode插件开发——语法高亮(效果图)

  [复制链接]
answdl 发表于 2023-4-5 21:32
vscode新语言插件
自带的语法高亮属性名称及效果
comment.PNG
constant.PNG
emphasis.PNG
entity.PNG
header.PNG
invalid.PNG
keyword.PNG
markup.PNG
meta.PNG
metatag.PNG
storage.PNG
string.PNG
strong.PNG
support.PNG
variable.PNG

项目->syntaxes文件夹->nasm.tmLanguage.json(在这个文件夹里开始只有一个文件)
在控制语法高亮的代码里,有5个大模块,其中“$schema”(链接里是语言插件的说明)、"name"、"scopeName"在项目自动创建的时候就设置好了,没什么特别的
值得注意的只有"patterns"和"repository"
"patterns":>很像一个头文件,"repository"里有几个分类,就要写几个{"include": "#名称"}
"repository":>就是控制语法显示哪一种颜色的地方了,我这里写了3个,"keywords"和"numeric"的结构基本一样,"name": "填上面的属性名称","match": "这里是用正则表达式来匹配文本的"
"strings"要填内容的多些,"patterns"是设置字符串里面的内容显示效果的,"begin"和"end"确定在什么情况下以字符串的颜色显示
[JavaScript] 纯文本查看 复制代码
{
    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
    "name": "nasm",
    "patterns": [
        {
            "include": "#keywords"
        },
        {
            "include": "#strings"
        },
        {
            "include": "#numeric"
        }
    ],
    "repository": {
        "keywords": {
            "patterns": [
                {
                    "name": "comment",
                    "match": "\\bABC_abc_123_000\\b"
                }
            ]
        },
        "strings": {
            "name": "string.quoted.double",
            "begin": "\"|'",
            "end": "\"|'",
            "patterns": [
                {
                    "name": "constant.character.escape",
                    "match": "\\\\."
                }
            ]
        },
        "numeric": {
            "patterns": [
                {
                    "name": "constant.numeric",
                    "match": "\\b0x[0-9a-fA-F]+\\b"
                }
            ]
        }
    },
    "scopeName": "source.asm"
}


最后附上所有名称
[C] 纯文本查看 复制代码
"comment",
"comment.block",
"comment.block.documentation",
"comment.line",
"comment.line.double-dash",
"comment.line.double-slash",
"comment.line.number-sign",
"comment.line.percentage",
"constant",
"constant.character",
"constant.character.escape",
"constant.language",
"constant.numeric",
"constant.other",
"constant.regexp",
"constant.rgb-value",
"constant.sha.git-rebase",
"emphasis",
"entity",
"entity.name",
"entity.name.class",
"entity.name.function",
"entity.name.method",
"entity.name.section",
"entity.name.selector",
"entity.name.tag",
"entity.name.type",
"entity.other",
"entity.other.attribute-name",
"entity.other.inherited-class",
"header",
"invalid",
"invalid.deprecated",
"invalid.illegal",
"keyword",
"keyword.control",
"keyword.control.less",
"keyword.operator",
"keyword.operator.new",
"keyword.other",
"keyword.other.unit",
"markup",
"markup.bold",
"markup.changed",
"markup.deleted",
"markup.heading",
"markup.inline.raw",
"markup.inserted",
"markup.italic",
"markup.list",
"markup.list.numbered",
"markup.list.unnumbered",
"markup.other",
"markup.punctuation.list.beginning",
"markup.punctuation.quote.beginning",
"markup.quote",
"markup.raw",
"markup.underline",
"markup.underline.link",
"meta",
"meta.cast",
"meta.parameter.type.variable",
"meta.preprocessor",
"meta.preprocessor.numeric",
"meta.preprocessor.string",
"meta.return-type",
"meta.selector",
"meta.structure.dictionary.key.python",
"meta.tag",
"meta.type.annotation",
"meta.type.name",
"metatag.php",
"storage",
"storage.modifier",
"storage.modifier.import.java",
"storage.modifier.package.java",
"storage.type",
"storage.type.cs",
"storage.type.java",
"string",
"string.html",
"string.interpolated",
"string.jade",
"string.other",
"string.quoted",
"string.quoted.double",
"string.quoted.other",
"string.quoted.single",
"string.quoted.triple",
"string.regexp",
"string.unquoted",
"string.xml",
"string.yaml",
"strong",
"support",
"support.class",
"support.constant",
"support.function",
"support.function.git-rebase",
"support.other",
"support.property-value",
"support.type",
"support.type.property-name",
"support.type.property-name.css",
"support.type.property-name.less",
"support.type.property-name.scss",
"support.variable",
"variable",
"variable.language",
"variable.name",
"variable.other",
"variable.parameter"

免费评分

参与人数 4吾爱币 +4 热心值 +3 收起 理由
脱下小可爱 + 1 + 1 我很赞同!
wizarrr + 1 + 1 谢谢@Thanks!
Kdocke + 1 我很赞同!
amd123 + 1 + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

4K60FPS 发表于 2023-4-5 22:54
赞一个,lz加油
hyz20230313 发表于 2023-4-5 22:54
lsy_loren 发表于 2023-4-6 08:42
PhoenixOe 发表于 2023-4-6 08:44
学习了,学习了
多幸运遇见baby 发表于 2023-4-6 09:21
加油!!
935 发表于 2023-4-6 09:48
谢谢大佬无私分享!
Zoeylander 发表于 2023-4-6 10:44
感谢大佬,认真学习了 !
wizarrr 发表于 2023-4-6 12:36
感谢,学习!
zx1086 发表于 2023-4-6 14:34
这个厉害了, 这个高亮看的好舒服啊
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-28 07:05

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表