注释补全

This commit is contained in:
mxd
2021-07-28 22:18:07 +08:00
parent 917f2f344f
commit 7d0fee9066

View File

@@ -17,6 +17,41 @@ export const initializeMagicScript = () => {
['[', ']'],
['(', ')'],
],
onEnterRules: [
{
// e.g. /** | */
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: {
indentAction: monaco.languages.IndentAction.IndentOutdent,
appendText: ' * '
}
},
{
// e.g. /** ...|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: {
indentAction: monaco.languages.IndentAction.None,
appendText: ' * '
}
},
{
// e.g. * ...|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
action: {
indentAction: monaco.languages.IndentAction.None,
appendText: '* '
}
},
{
// e.g. */|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
action: {
indentAction: monaco.languages.IndentAction.None,
removeText: 1
}
}
],
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
@@ -29,6 +64,7 @@ export const initializeMagicScript = () => {
{open: '"""', close: '"""', notIn: ['string.multi']},
{open: '"', close: '"', notIn: ['string']},
{open: '\'', close: '\'', notIn: ['string']},
{open: '/**', close: ' */', notIn: ['string'] }
],
})