mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 01:28:26 -05:00
Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)
* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 * fix config changes * fix strictnull checks
This commit is contained in:
@@ -63,11 +63,11 @@ suite('Editor Commands - Trim Trailing Whitespace Command', () => {
|
||||
'even more text ',
|
||||
'and some mixed\t \t'
|
||||
], [
|
||||
createSingleEditOp(null, 1, 10, 1, 11),
|
||||
createSingleEditOp(null, 3, 1, 3, 4),
|
||||
createSingleEditOp(null, 4, 15, 4, 17),
|
||||
createSingleEditOp(null, 5, 15, 5, 20)
|
||||
]);
|
||||
createSingleEditOp(null, 1, 10, 1, 11),
|
||||
createSingleEditOp(null, 3, 1, 3, 4),
|
||||
createSingleEditOp(null, 4, 15, 4, 17),
|
||||
createSingleEditOp(null, 5, 15, 5, 20)
|
||||
]);
|
||||
|
||||
|
||||
assertTrimTrailingWhitespace(['text '], [new Position(1, 1), new Position(1, 2), new Position(1, 3)], [createInsertDeleteSingleEditOp(null, 1, 5, 1, 8)]);
|
||||
@@ -80,11 +80,11 @@ suite('Editor Commands - Trim Trailing Whitespace Command', () => {
|
||||
'even more text ',
|
||||
'and some mixed\t \t'
|
||||
], [], [
|
||||
createInsertDeleteSingleEditOp(null, 1, 10, 1, 11),
|
||||
createInsertDeleteSingleEditOp(null, 3, 1, 3, 4),
|
||||
createInsertDeleteSingleEditOp(null, 4, 15, 4, 17),
|
||||
createInsertDeleteSingleEditOp(null, 5, 15, 5, 20)
|
||||
]);
|
||||
createInsertDeleteSingleEditOp(null, 1, 10, 1, 11),
|
||||
createInsertDeleteSingleEditOp(null, 3, 1, 3, 4),
|
||||
createInsertDeleteSingleEditOp(null, 4, 15, 4, 17),
|
||||
createInsertDeleteSingleEditOp(null, 5, 15, 5, 20)
|
||||
]);
|
||||
assertTrimTrailingWhitespace([
|
||||
'some text\t',
|
||||
'some more text',
|
||||
@@ -92,10 +92,10 @@ suite('Editor Commands - Trim Trailing Whitespace Command', () => {
|
||||
'even more text ',
|
||||
'and some mixed\t \t'
|
||||
], [new Position(1, 11), new Position(3, 2), new Position(5, 1), new Position(4, 1), new Position(5, 10)], [
|
||||
createInsertDeleteSingleEditOp(null, 3, 2, 3, 4),
|
||||
createInsertDeleteSingleEditOp(null, 4, 15, 4, 17),
|
||||
createInsertDeleteSingleEditOp(null, 5, 15, 5, 20)
|
||||
]);
|
||||
createInsertDeleteSingleEditOp(null, 3, 2, 3, 4),
|
||||
createInsertDeleteSingleEditOp(null, 4, 15, 4, 17),
|
||||
createInsertDeleteSingleEditOp(null, 5, 15, 5, 20)
|
||||
]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -711,7 +711,7 @@ suite('Editor Controller - Cursor', () => {
|
||||
position: new Position(4, 4),
|
||||
viewPosition: new Position(4, 4),
|
||||
mouseColumn: 15,
|
||||
setAnchorIfNotSet: false
|
||||
doColumnSelect: true
|
||||
});
|
||||
|
||||
let expectedSelections = [
|
||||
@@ -747,7 +747,7 @@ suite('Editor Controller - Cursor', () => {
|
||||
position: new Position(4, 1),
|
||||
viewPosition: new Position(4, 1),
|
||||
mouseColumn: 1,
|
||||
setAnchorIfNotSet: false
|
||||
doColumnSelect: true
|
||||
});
|
||||
|
||||
assertCursor(cursor, [
|
||||
@@ -787,7 +787,7 @@ suite('Editor Controller - Cursor', () => {
|
||||
position: new Position(1, 1),
|
||||
viewPosition: new Position(1, 1),
|
||||
mouseColumn: 1,
|
||||
setAnchorIfNotSet: false
|
||||
doColumnSelect: true
|
||||
});
|
||||
assertCursor(cursor, [
|
||||
new Selection(10, 10, 10, 1),
|
||||
@@ -806,7 +806,7 @@ suite('Editor Controller - Cursor', () => {
|
||||
position: new Position(1, 1),
|
||||
viewPosition: new Position(1, 1),
|
||||
mouseColumn: 1,
|
||||
setAnchorIfNotSet: false
|
||||
doColumnSelect: true
|
||||
});
|
||||
assertCursor(cursor, [
|
||||
new Selection(10, 10, 10, 1),
|
||||
@@ -1566,6 +1566,37 @@ suite('Editor Controller - Regression tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('issue #43722: Multiline paste doesn\'t work anymore', () => {
|
||||
usingCursor({
|
||||
text: [
|
||||
'test',
|
||||
'test',
|
||||
'test',
|
||||
'test'
|
||||
],
|
||||
}, (model, cursor) => {
|
||||
cursor.setSelections('test', [
|
||||
new Selection(1, 1, 1, 5),
|
||||
new Selection(2, 1, 2, 5),
|
||||
new Selection(3, 1, 3, 5),
|
||||
new Selection(4, 1, 4, 5),
|
||||
]);
|
||||
|
||||
cursorCommand(cursor, H.Paste, {
|
||||
text: 'aaa\r\nbbb\r\nccc\r\nddd\r\n',
|
||||
pasteOnNewLine: false,
|
||||
multicursorText: null
|
||||
});
|
||||
|
||||
assert.equal(model.getValue(), [
|
||||
'aaa',
|
||||
'bbb',
|
||||
'ccc',
|
||||
'ddd',
|
||||
].join('\n'));
|
||||
});
|
||||
});
|
||||
|
||||
test('issue #46440: (1) Pasting a multi-line selection pastes entire selection into every insertion point', () => {
|
||||
usingCursor({
|
||||
text: [
|
||||
|
||||
@@ -483,11 +483,11 @@ function selectionEqual(selection: Selection, posLineNumber: number, posColumn:
|
||||
positionLineNumber: selection.positionLineNumber,
|
||||
positionColumn: selection.positionColumn
|
||||
}, {
|
||||
selectionStartLineNumber: selLineNumber,
|
||||
selectionStartColumn: selColumn,
|
||||
positionLineNumber: posLineNumber,
|
||||
positionColumn: posColumn
|
||||
}, 'selection equal');
|
||||
selectionStartLineNumber: selLineNumber,
|
||||
selectionStartColumn: selColumn,
|
||||
positionLineNumber: posLineNumber,
|
||||
positionColumn: posColumn
|
||||
}, 'selection equal');
|
||||
}
|
||||
|
||||
function moveTo(cursor: Cursor, lineNumber: number, column: number, inSelectionMode: boolean = false) {
|
||||
|
||||
@@ -25,7 +25,7 @@ export class TestCodeEditorService extends AbstractCodeEditorService {
|
||||
}
|
||||
|
||||
export class TestCommandService implements ICommandService {
|
||||
_serviceBrand: any;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private readonly _instantiationService: IInstantiationService;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ suite('OpenerService', function () {
|
||||
let lastCommand: { id: string; args: any[] } | undefined;
|
||||
|
||||
const commandService = new (class implements ICommandService {
|
||||
_serviceBrand: any;
|
||||
_serviceBrand: undefined;
|
||||
onWillExecuteCommand = () => ({ dispose: () => { } });
|
||||
onDidExecuteCommand = () => ({ dispose: () => { } });
|
||||
executeCommand(id: string, ...args: any[]): Promise<any> {
|
||||
|
||||
@@ -91,7 +91,12 @@ export function withTestCodeEditor(text: string | string[] | null, options: Test
|
||||
|
||||
export function createTestCodeEditor(options: TestCodeEditorCreationOptions): TestCodeEditor {
|
||||
|
||||
const model = options.model;
|
||||
delete options.model;
|
||||
|
||||
const services: ServiceCollection = options.serviceCollection || new ServiceCollection();
|
||||
delete options.serviceCollection;
|
||||
|
||||
const instantiationService: IInstantiationService = new InstantiationService(services);
|
||||
|
||||
if (!services.has(ICodeEditorService)) {
|
||||
@@ -119,6 +124,6 @@ export function createTestCodeEditor(options: TestCodeEditorCreationOptions): Te
|
||||
options,
|
||||
codeEditorWidgetOptions
|
||||
);
|
||||
editor.setModel(options.model);
|
||||
editor.setModel(model);
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { IEditorHoverOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IEditorHoverOptions, EditorOption, ConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions';
|
||||
import { EditorZoom } from 'vs/editor/common/config/editorZoom';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
@@ -67,8 +67,10 @@ suite('Common Editor Config', () => {
|
||||
}
|
||||
|
||||
function assertWrapping(config: TestConfiguration, isViewportWrapping: boolean, wrappingColumn: number): void {
|
||||
assert.equal(config.editor.wrappingInfo.isViewportWrapping, isViewportWrapping);
|
||||
assert.equal(config.editor.wrappingInfo.wrappingColumn, wrappingColumn);
|
||||
const options = config.options;
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
assert.equal(wrappingInfo.isViewportWrapping, isViewportWrapping);
|
||||
assert.equal(wrappingInfo.wrappingColumn, wrappingColumn);
|
||||
}
|
||||
|
||||
test('wordWrap default', () => {
|
||||
@@ -184,8 +186,19 @@ suite('Common Editor Config', () => {
|
||||
});
|
||||
let config = new TestConfiguration({ hover: hoverOptions });
|
||||
|
||||
assert.equal(config.editor.contribInfo.hover.enabled, true);
|
||||
assert.equal(config.options.get(EditorOption.hover).enabled, true);
|
||||
config.updateOptions({ hover: { enabled: false } });
|
||||
assert.equal(config.editor.contribInfo.hover.enabled, false);
|
||||
assert.equal(config.options.get(EditorOption.hover).enabled, false);
|
||||
});
|
||||
|
||||
test('does not emit event when nothing changes', () => {
|
||||
const config = new TestConfiguration({ glyphMargin: true, roundedSelection: false });
|
||||
let event: ConfigurationChangedEvent | null = null;
|
||||
config.onDidChange(e => event = e);
|
||||
assert.equal(config.options.get(EditorOption.glyphMargin), true);
|
||||
|
||||
config.updateOptions({ glyphMargin: true });
|
||||
config.updateOptions({ roundedSelection: false });
|
||||
assert.equal(event, null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -306,10 +306,10 @@ suite('PieceTreeTextBuffer._toSingleEditOperation', () => {
|
||||
'',
|
||||
'1'
|
||||
], [
|
||||
editOp(1, 1, 1, 3, 0, 2, ['Your']),
|
||||
editOp(1, 4, 1, 4, 3, 0, ['Interesting ']),
|
||||
editOp(2, 3, 2, 6, 16, 3, null)
|
||||
],
|
||||
editOp(1, 1, 1, 3, 0, 2, ['Your']),
|
||||
editOp(1, 4, 1, 4, 3, 0, ['Interesting ']),
|
||||
editOp(2, 3, 2, 6, 16, 3, null)
|
||||
],
|
||||
editOp(1, 1, 2, 6, 0, 19, [
|
||||
'Your Interesting First Line',
|
||||
'\t\t'
|
||||
|
||||
@@ -1312,8 +1312,8 @@ suite('deltaDecorations', () => {
|
||||
endLineNumber: 1,
|
||||
endColumn: 1
|
||||
}, {
|
||||
stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
|
||||
}
|
||||
stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
|
||||
}
|
||||
);
|
||||
});
|
||||
model.changeDecorations((changeAccessor) => {
|
||||
|
||||
@@ -611,25 +611,25 @@ suite('TextModelSearch', () => {
|
||||
});
|
||||
|
||||
test('parseSearchRequest non regex', () => {
|
||||
assertParseSearchResult('foo', false, false, null, new SearchData(/foo/gi, null, null));
|
||||
assertParseSearchResult('foo', false, false, USUAL_WORD_SEPARATORS, new SearchData(/foo/gi, usualWordSeparators, null));
|
||||
assertParseSearchResult('foo', false, true, null, new SearchData(/foo/g, null, 'foo'));
|
||||
assertParseSearchResult('foo', false, true, USUAL_WORD_SEPARATORS, new SearchData(/foo/g, usualWordSeparators, 'foo'));
|
||||
assertParseSearchResult('foo\\n', false, false, null, new SearchData(/foo\\n/gi, null, null));
|
||||
assertParseSearchResult('foo\\\\n', false, false, null, new SearchData(/foo\\\\n/gi, null, null));
|
||||
assertParseSearchResult('foo\\r', false, false, null, new SearchData(/foo\\r/gi, null, null));
|
||||
assertParseSearchResult('foo\\\\r', false, false, null, new SearchData(/foo\\\\r/gi, null, null));
|
||||
assertParseSearchResult('foo', false, false, null, new SearchData(/foo/giu, null, null));
|
||||
assertParseSearchResult('foo', false, false, USUAL_WORD_SEPARATORS, new SearchData(/foo/giu, usualWordSeparators, null));
|
||||
assertParseSearchResult('foo', false, true, null, new SearchData(/foo/gu, null, 'foo'));
|
||||
assertParseSearchResult('foo', false, true, USUAL_WORD_SEPARATORS, new SearchData(/foo/gu, usualWordSeparators, 'foo'));
|
||||
assertParseSearchResult('foo\\n', false, false, null, new SearchData(/foo\\n/giu, null, null));
|
||||
assertParseSearchResult('foo\\\\n', false, false, null, new SearchData(/foo\\\\n/giu, null, null));
|
||||
assertParseSearchResult('foo\\r', false, false, null, new SearchData(/foo\\r/giu, null, null));
|
||||
assertParseSearchResult('foo\\\\r', false, false, null, new SearchData(/foo\\\\r/giu, null, null));
|
||||
});
|
||||
|
||||
test('parseSearchRequest regex', () => {
|
||||
assertParseSearchResult('foo', true, false, null, new SearchData(/foo/gi, null, null));
|
||||
assertParseSearchResult('foo', true, false, USUAL_WORD_SEPARATORS, new SearchData(/foo/gi, usualWordSeparators, null));
|
||||
assertParseSearchResult('foo', true, true, null, new SearchData(/foo/g, null, null));
|
||||
assertParseSearchResult('foo', true, true, USUAL_WORD_SEPARATORS, new SearchData(/foo/g, usualWordSeparators, null));
|
||||
assertParseSearchResult('foo\\n', true, false, null, new SearchData(/foo\n/gim, null, null));
|
||||
assertParseSearchResult('foo\\\\n', true, false, null, new SearchData(/foo\\n/gi, null, null));
|
||||
assertParseSearchResult('foo\\r', true, false, null, new SearchData(/foo\r/gim, null, null));
|
||||
assertParseSearchResult('foo\\\\r', true, false, null, new SearchData(/foo\\r/gi, null, null));
|
||||
assertParseSearchResult('foo', true, false, null, new SearchData(/foo/giu, null, null));
|
||||
assertParseSearchResult('foo', true, false, USUAL_WORD_SEPARATORS, new SearchData(/foo/giu, usualWordSeparators, null));
|
||||
assertParseSearchResult('foo', true, true, null, new SearchData(/foo/gu, null, null));
|
||||
assertParseSearchResult('foo', true, true, USUAL_WORD_SEPARATORS, new SearchData(/foo/gu, usualWordSeparators, null));
|
||||
assertParseSearchResult('foo\\n', true, false, null, new SearchData(/foo\n/gimu, null, null));
|
||||
assertParseSearchResult('foo\\\\n', true, false, null, new SearchData(/foo\\n/giu, null, null));
|
||||
assertParseSearchResult('foo\\r', true, false, null, new SearchData(/foo\r/gimu, null, null));
|
||||
assertParseSearchResult('foo\\\\r', true, false, null, new SearchData(/foo\\r/giu, null, null));
|
||||
});
|
||||
|
||||
test('issue #53415. \W should match line break.', () => {
|
||||
@@ -721,6 +721,20 @@ suite('TextModelSearch', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('Simple find using unicode escape sequences', () => {
|
||||
assertFindMatches(
|
||||
regularText.join('\n'),
|
||||
'\\u{0066}\\u006f\\u006F', true, false, null,
|
||||
[
|
||||
[1, 14, 1, 17],
|
||||
[1, 44, 1, 47],
|
||||
[2, 22, 2, 25],
|
||||
[2, 48, 2, 51],
|
||||
[4, 59, 4, 62]
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
test('isMultilineRegexSource', () => {
|
||||
assert(!isMultilineRegexSource('foo'));
|
||||
assert(!isMultilineRegexSource(''));
|
||||
|
||||
@@ -138,10 +138,10 @@ suite('TextModelWithTokens', () => {
|
||||
testBrackets([
|
||||
'if (a == 3) { return (7 * (a + 5)); }'
|
||||
], [
|
||||
['{', '}'],
|
||||
['[', ']'],
|
||||
['(', ')']
|
||||
]);
|
||||
['{', '}'],
|
||||
['[', ']'],
|
||||
['(', ')']
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -334,8 +334,8 @@ suite('Token theme resolving', () => {
|
||||
let actual = TokenTheme.createFromParsedTokenTheme([
|
||||
new ParsedTokenThemeRule('var', -1, FontStyle.NotSet, 'F8F8F2', null)
|
||||
], [
|
||||
'000000', 'FFFFFF', '0F0F0F'
|
||||
]);
|
||||
'000000', 'FFFFFF', '0F0F0F'
|
||||
]);
|
||||
let colorMap = new ColorMap();
|
||||
colorMap.getId('000000');
|
||||
colorMap.getId('FFFFFF');
|
||||
|
||||
@@ -367,7 +367,7 @@ assertComputeEdits(file1, file2);
|
||||
|
||||
class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
|
||||
|
||||
_serviceBrand: any;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,34 +66,34 @@ suite('Editor ViewLayout - ViewLineParts', () => {
|
||||
new LineDecoration(1, 2, 'c1', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 0, 'c1'),
|
||||
new DecorationSegment(2, 2, 'c2')
|
||||
]);
|
||||
new DecorationSegment(0, 0, 'c1'),
|
||||
new DecorationSegment(2, 2, 'c2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [
|
||||
new LineDecoration(1, 3, 'c1', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 1, 'c1'),
|
||||
new DecorationSegment(2, 2, 'c2')
|
||||
]);
|
||||
new DecorationSegment(0, 1, 'c1'),
|
||||
new DecorationSegment(2, 2, 'c2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [
|
||||
new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 1, 'c1'),
|
||||
new DecorationSegment(2, 2, 'c1 c2')
|
||||
]);
|
||||
new DecorationSegment(0, 1, 'c1'),
|
||||
new DecorationSegment(2, 2, 'c1 c2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [
|
||||
new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular),
|
||||
new LineDecoration(1, 4, 'c1*', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 1, 'c1 c1*'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c2')
|
||||
]);
|
||||
new DecorationSegment(0, 1, 'c1 c1*'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [
|
||||
new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular),
|
||||
@@ -101,9 +101,9 @@ suite('Editor ViewLayout - ViewLineParts', () => {
|
||||
new LineDecoration(1, 4, 'c1**', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 1, 'c1 c1* c1**'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c1** c2')
|
||||
]);
|
||||
new DecorationSegment(0, 1, 'c1 c1* c1**'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c1** c2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [
|
||||
new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular),
|
||||
@@ -112,9 +112,9 @@ suite('Editor ViewLayout - ViewLineParts', () => {
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 4, 'c2*', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 1, 'c1 c1* c1**'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*')
|
||||
]);
|
||||
new DecorationSegment(0, 1, 'c1 c1* c1**'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*')
|
||||
]);
|
||||
|
||||
assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [
|
||||
new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular),
|
||||
@@ -123,9 +123,9 @@ suite('Editor ViewLayout - ViewLineParts', () => {
|
||||
new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular),
|
||||
new LineDecoration(3, 5, 'c2*', InlineDecorationType.Regular)
|
||||
]), [
|
||||
new DecorationSegment(0, 1, 'c1 c1* c1**'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'),
|
||||
new DecorationSegment(3, 3, 'c2*')
|
||||
]);
|
||||
new DecorationSegment(0, 1, 'c1 c1* c1**'),
|
||||
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'),
|
||||
new DecorationSegment(3, 3, 'c2*')
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +19,8 @@ import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer'
|
||||
import { ILineMapping, ISimpleModel, SplitLine, SplitLinesCollection } from 'vs/editor/common/viewModel/splitLinesCollection';
|
||||
import { ViewLineData } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
|
||||
suite('Editor ViewModel - SplitLinesCollection', () => {
|
||||
test('SplitLine', () => {
|
||||
@@ -88,15 +90,21 @@ suite('Editor ViewModel - SplitLinesCollection', () => {
|
||||
});
|
||||
|
||||
function withSplitLinesCollection(text: string, callback: (model: TextModel, linesCollection: SplitLinesCollection) => void): void {
|
||||
let config = new TestConfiguration({});
|
||||
const config = new TestConfiguration({});
|
||||
const wrappingInfo = config.options.get(EditorOption.wrappingInfo);
|
||||
const fontInfo = config.options.get(EditorOption.fontInfo);
|
||||
const wordWrapBreakAfterCharacters = config.options.get(EditorOption.wordWrapBreakAfterCharacters);
|
||||
const wordWrapBreakBeforeCharacters = config.options.get(EditorOption.wordWrapBreakBeforeCharacters);
|
||||
const wordWrapBreakObtrusiveCharacters = config.options.get(EditorOption.wordWrapBreakObtrusiveCharacters);
|
||||
const wrappingIndent = config.options.get(EditorOption.wrappingIndent);
|
||||
|
||||
let hardWrappingLineMapperFactory = new CharacterHardWrappingLineMapperFactory(
|
||||
config.editor.wrappingInfo.wordWrapBreakBeforeCharacters,
|
||||
config.editor.wrappingInfo.wordWrapBreakAfterCharacters,
|
||||
config.editor.wrappingInfo.wordWrapBreakObtrusiveCharacters
|
||||
const hardWrappingLineMapperFactory = new CharacterHardWrappingLineMapperFactory(
|
||||
wordWrapBreakBeforeCharacters,
|
||||
wordWrapBreakAfterCharacters,
|
||||
wordWrapBreakObtrusiveCharacters
|
||||
);
|
||||
|
||||
let model = TextModel.createFromString([
|
||||
const model = TextModel.createFromString([
|
||||
'int main() {',
|
||||
'\tprintf("Hello world!");',
|
||||
'}',
|
||||
@@ -105,13 +113,13 @@ suite('Editor ViewModel - SplitLinesCollection', () => {
|
||||
'}',
|
||||
].join('\n'));
|
||||
|
||||
let linesCollection = new SplitLinesCollection(
|
||||
const linesCollection = new SplitLinesCollection(
|
||||
model,
|
||||
hardWrappingLineMapperFactory,
|
||||
model.getOptions().tabSize,
|
||||
config.editor.wrappingInfo.wrappingColumn,
|
||||
config.editor.fontInfo.typicalFullwidthCharacterWidth / config.editor.fontInfo.typicalHalfwidthCharacterWidth,
|
||||
config.editor.wrappingInfo.wrappingIndent
|
||||
wrappingInfo.wrappingColumn,
|
||||
fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth,
|
||||
wrappingIndent
|
||||
);
|
||||
|
||||
callback(model, linesCollection);
|
||||
@@ -732,25 +740,31 @@ suite('SplitLinesCollection', () => {
|
||||
});
|
||||
|
||||
function withSplitLinesCollection(model: TextModel, wordWrap: 'on' | 'off' | 'wordWrapColumn' | 'bounded', wordWrapColumn: number, callback: (splitLinesCollection: SplitLinesCollection) => void): void {
|
||||
let configuration = new TestConfiguration({
|
||||
const configuration = new TestConfiguration({
|
||||
wordWrap: wordWrap,
|
||||
wordWrapColumn: wordWrapColumn,
|
||||
wrappingIndent: 'indent'
|
||||
});
|
||||
const wrappingInfo = configuration.options.get(EditorOption.wrappingInfo);
|
||||
const fontInfo = configuration.options.get(EditorOption.fontInfo);
|
||||
const wordWrapBreakAfterCharacters = configuration.options.get(EditorOption.wordWrapBreakAfterCharacters);
|
||||
const wordWrapBreakBeforeCharacters = configuration.options.get(EditorOption.wordWrapBreakBeforeCharacters);
|
||||
const wordWrapBreakObtrusiveCharacters = configuration.options.get(EditorOption.wordWrapBreakObtrusiveCharacters);
|
||||
const wrappingIndent = configuration.options.get(EditorOption.wrappingIndent);
|
||||
|
||||
let factory = new CharacterHardWrappingLineMapperFactory(
|
||||
configuration.editor.wrappingInfo.wordWrapBreakBeforeCharacters,
|
||||
configuration.editor.wrappingInfo.wordWrapBreakAfterCharacters,
|
||||
configuration.editor.wrappingInfo.wordWrapBreakObtrusiveCharacters
|
||||
const factory = new CharacterHardWrappingLineMapperFactory(
|
||||
wordWrapBreakBeforeCharacters,
|
||||
wordWrapBreakAfterCharacters,
|
||||
wordWrapBreakObtrusiveCharacters
|
||||
);
|
||||
|
||||
let linesCollection = new SplitLinesCollection(
|
||||
const linesCollection = new SplitLinesCollection(
|
||||
model,
|
||||
factory,
|
||||
model.getOptions().tabSize,
|
||||
configuration.editor.wrappingInfo.wrappingColumn,
|
||||
configuration.editor.fontInfo.typicalFullwidthCharacterWidth / configuration.editor.fontInfo.typicalHalfwidthCharacterWidth,
|
||||
configuration.editor.wrappingInfo.wrappingIndent
|
||||
wrappingInfo.wrappingColumn,
|
||||
fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth,
|
||||
wrappingIndent
|
||||
);
|
||||
|
||||
callback(linesCollection);
|
||||
|
||||
Reference in New Issue
Block a user