Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -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);
});
});

View File

@@ -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'

View File

@@ -1312,8 +1312,8 @@ suite('deltaDecorations', () => {
endLineNumber: 1,
endColumn: 1
}, {
stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
}
stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
}
);
});
model.changeDecorations((changeAccessor) => {

View File

@@ -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(''));

View File

@@ -138,10 +138,10 @@ suite('TextModelWithTokens', () => {
testBrackets([
'if (a == 3) { return (7 * (a + 5)); }'
], [
['{', '}'],
['[', ']'],
['(', ')']
]);
['{', '}'],
['[', ']'],
['(', ')']
]);
});
});

View File

@@ -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');

View File

@@ -367,7 +367,7 @@ assertComputeEdits(file1, file2);
class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
_serviceBrand: any;
_serviceBrand: undefined;
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,

View File

@@ -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*')
]);
});
});

View File

@@ -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);