mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Fixes 114236: Add a multi-line comment regex to unIndentedLinePattern (#114478)
* Add a multi-line comment regex to unIndentedLinePattern * Add multi-line comment block indentation tests * Fix a multi-line comment block indentation test
This commit is contained in:
parent
b2724146f0
commit
76524ef589
|
@ -15,7 +15,9 @@ import * as languageModeIds from '../utils/languageModeIds';
|
|||
const jsTsLanguageConfiguration: vscode.LanguageConfiguration = {
|
||||
indentationRules: {
|
||||
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/,
|
||||
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/
|
||||
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/,
|
||||
// e.g. * ...| or */| or *-----*/|
|
||||
unIndentedLinePattern: /^(\t|[ ])*[ ]\*[^/]*\*\/\s*$|^(\t|[ ])*[ ]\*\/\s*$|^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/
|
||||
},
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||
onEnterRules: [
|
||||
|
|
|
@ -67,4 +67,47 @@ suite.skip('OnEnter', () => {
|
|||
` x`));
|
||||
});
|
||||
});
|
||||
|
||||
test('should not indent after a multi-line comment block 1', () => {
|
||||
return withRandomFileEditor(`/*-----\n * line 1\n * line 2\n *-----*/\n${CURSOR}`, 'js', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(
|
||||
document.getText(),
|
||||
joinLines(
|
||||
`/*-----`,
|
||||
` * line 1`,
|
||||
` * line 2`,
|
||||
` *-----*/`,
|
||||
``,
|
||||
`x`));
|
||||
});
|
||||
});
|
||||
|
||||
test('should not indent after a multi-line comment block 2', () => {
|
||||
return withRandomFileEditor(`/*-----\n * line 1\n * line 2\n */\n${CURSOR}`, 'js', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(
|
||||
document.getText(),
|
||||
joinLines(
|
||||
`/*-----`,
|
||||
` * line 1`,
|
||||
` * line 2`,
|
||||
` */`,
|
||||
``,
|
||||
`x`));
|
||||
});
|
||||
});
|
||||
|
||||
test('should indent within a multi-line comment block', () => {
|
||||
return withRandomFileEditor(`/*-----\n * line 1\n * line 2${CURSOR}`, 'js', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(
|
||||
document.getText(),
|
||||
joinLines(
|
||||
`/*-----`,
|
||||
` * line 1`,
|
||||
` * line 2`,
|
||||
` * x`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue