mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
adding more tests
This commit is contained in:
parent
b1229cc440
commit
055bf7b221
|
@ -738,7 +738,7 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
|
|||
test.skip('issue #43244: indent after equal sign is detected', () => {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/43244
|
||||
// issue: Indent after an equal sign is detected followed by whitespace.
|
||||
// issue: Should indent after an equal sign is detected followed by whitespace characters.
|
||||
// This should be outdented when a semi-colon is detected indicating the end of the assignment.
|
||||
|
||||
const model = createTextModel([
|
||||
|
@ -783,7 +783,7 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
|
|||
test.skip('issue #43244: indent after dot detected on a subsequent line after object/array signifying a method call', () => {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/43244
|
||||
// issue: when a dot is written, we should detect that this is a method call and indent accordingly
|
||||
// issue: When a dot is written, we should detect that this is a method call and indent accordingly
|
||||
|
||||
const model = createTextModel([
|
||||
'const array = [1, 2, 3]',
|
||||
|
@ -825,6 +825,51 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test.skip('issue #43244: outdent when a semi-color is detected indicating the end of the assignment', () => {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/43244
|
||||
|
||||
const model = createTextModel([
|
||||
'const array = [1, 2, 3]',
|
||||
' .filter(() => true);'
|
||||
].join('\n'), languageId, {});
|
||||
disposables.add(model);
|
||||
|
||||
withTestCodeEditor(model, { autoIndent: "full" }, (editor, viewModel, instantiationService) => {
|
||||
registerLanguage(instantiationService, languageId, Language.TypeScript, disposables);
|
||||
editor.setSelection(new Selection(2, 25, 2, 25));
|
||||
viewModel.type("\n", 'keyboard');
|
||||
assert.strictEqual(model.getValue(), [
|
||||
'const array = [1, 2, 3]',
|
||||
' .filter(() => true);',
|
||||
''
|
||||
].join('\n'));
|
||||
});
|
||||
});
|
||||
|
||||
test.skip('issue #43244: indent when lambda arrow function is detected, outdent when end is reached', () => {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/43244
|
||||
|
||||
const model = createTextModel([
|
||||
'const array = [1, 2, 3, 4, 5];',
|
||||
'array.map(v =>)'
|
||||
].join('\n'), languageId, {});
|
||||
disposables.add(model);
|
||||
|
||||
withTestCodeEditor(model, { autoIndent: "full" }, (editor, viewModel, instantiationService) => {
|
||||
registerLanguage(instantiationService, languageId, Language.TypeScript, disposables);
|
||||
editor.setSelection(new Selection(2, 15, 2, 15));
|
||||
viewModel.type("\n", 'keyboard');
|
||||
assert.strictEqual(model.getValue(), [
|
||||
'const array = [1, 2, 3, 4, 5];',
|
||||
'array.map(v =>',
|
||||
' ',
|
||||
')'
|
||||
].join('\n'));
|
||||
});
|
||||
});
|
||||
|
||||
// Add tests for:
|
||||
// https://github.com/microsoft/vscode/issues/88638
|
||||
// https://github.com/microsoft/vscode/issues/63388
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const javascriptIndentationRules = {
|
||||
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/,
|
||||
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]\)].*$/,
|
||||
increaseIndentPattern: /^((?!\/\/).)*(\{([^}"'`]*|(\t|[ ])*\/\/.*)|\([^)"'`]*|\[[^\]"'`]*)$/,
|
||||
// e.g. * ...| or */| or *-----*/|
|
||||
unIndentedLinePattern: /^(\t|[ ])*[ ]\*[^/]*\*\/\s*$|^(\t|[ ])*[ ]\*\/\s*$|^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/
|
||||
|
|
|
@ -309,4 +309,20 @@ suite('Auto-Reindentation - TypeScript/JavaScript', () => {
|
|||
const editOperations = getReindentEditOperations(model, languageConfigurationService, 1, model.getLineCount());
|
||||
assert.deepStrictEqual(editOperations.length, 0);
|
||||
});
|
||||
|
||||
test.skip('Issue 43244: incorrect indentation when signature of function call spans several lines', () => {
|
||||
|
||||
// issue: https://github.com/microsoft/vscode/issues/43244
|
||||
|
||||
const fileContents = [
|
||||
'function callSomeOtherFunction(one: number, two: number) { }',
|
||||
'function someFunction() {',
|
||||
' callSomeOtherFunction(4,',
|
||||
' 5)',
|
||||
'}',
|
||||
].join('\n');
|
||||
const model = disposables.add(instantiateTextModel(instantiationService, fileContents, languageId, options));
|
||||
const editOperations = getReindentEditOperations(model, languageConfigurationService, 1, model.getLineCount());
|
||||
assert.deepStrictEqual(editOperations.length, 0);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue