Restore injection grammar for multiline jsdoc types

For #108237

This only fixes the basic case of making sure multiline types in jsdoc do not capture the leading `*`
This commit is contained in:
Matt Bierner 2020-10-08 00:00:00 -06:00
parent 2dbd0ae6a4
commit f564bbd517
4 changed files with 178 additions and 10 deletions

View file

@ -79,6 +79,22 @@
"meta.import string.quoted": "other",
"variable.other.jsdoc": "other"
}
},
{
"scopeName": "documentation.injection.ts",
"path": "./syntaxes/jsdoc.ts.injection.tmLanguage.json",
"injectTo": [
"source.ts",
"source.tsx"
]
},
{
"scopeName": "documentation.injection.js.jsx",
"path": "./syntaxes/jsdoc.js.injection.tmLanguage.json",
"injectTo": [
"source.js",
"source.js.jsx"
]
}
],
"semanticTokenScopes": [

View file

@ -0,0 +1,21 @@
{
"injectionSelector": "L:comment.block.documentation",
"patterns": [
{
"include": "#jsdocbody"
}
],
"repository": {
"jsdocbody": {
"begin": "(?<=/\\*\\*)([^*]|\\*(?!/))*$",
"while": "(^|\\G)\\s*\\*(?!/)(?=([^*]|[*](?!/))*$)",
"patterns": [
{
"include": "source.ts#docblock"
}
]
}
},
"scopeName": "documentation.injection.js.jsx"
}

View file

@ -0,0 +1,21 @@
{
"injectionSelector": "L:comment.block.documentation",
"patterns": [
{
"include": "#jsdocbody"
}
],
"repository": {
"jsdocbody": {
"begin": "(?<=/\\*\\*)([^*]|\\*(?!/))*$",
"while": "(^|\\G)\\s*\\*(?!/)(?=([^*]|[*](?!/))*$)",
"patterns": [
{
"include": "source.ts#docblock"
}
]
}
},
"scopeName": "documentation.injection.ts"
}

View file

@ -77,7 +77,18 @@
}
},
{
"c": " * id: number,",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " id: number,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -88,7 +99,18 @@
}
},
{
"c": " * fn: !Function,",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " fn: !Function,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -99,7 +121,18 @@
}
},
{
"c": " * context: (!Object|undefined)",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " context: (!Object|undefined)",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -110,7 +143,18 @@
}
},
{
"c": " * }",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " }",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -352,7 +396,18 @@
}
},
{
"c": " * measureTask: goog.dom.animationFrame.Task_,",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " measureTask: goog.dom.animationFrame.Task_,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -363,7 +418,18 @@
}
},
{
"c": " * mutateTask: goog.dom.animationFrame.Task_,",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " mutateTask: goog.dom.animationFrame.Task_,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -374,7 +440,18 @@
}
},
{
"c": " * state: (!Object|undefined),",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " state: (!Object|undefined),",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -385,7 +462,18 @@
}
},
{
"c": " * args: (!Array|undefined),",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " args: (!Array|undefined),",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -396,7 +484,18 @@
}
},
{
"c": " * isScheduled: boolean",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " isScheduled: boolean",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -407,7 +506,18 @@
}
},
{
"c": " * }",
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " }",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",