Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229 (#8962)

* Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229

* skip failing tests

* update mac build image
This commit is contained in:
Anthony Dresser
2020-01-27 15:28:17 -08:00
committed by Karl Burtram
parent 0eaee18dc4
commit fefe1454de
481 changed files with 12764 additions and 7836 deletions

View File

@@ -4901,6 +4901,51 @@ suite('autoClosingPairs', () => {
mode.dispose();
});
test('issue #85983 - editor.autoClosingBrackets: beforeWhitespace is incorrect for Python', () => {
const languageId = new LanguageIdentifier('pythonMode', 5);
class PythonMode extends MockMode {
constructor() {
super(languageId);
this._register(LanguageConfigurationRegistry.register(this.getLanguageIdentifier(), {
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '\"', close: '\"', notIn: ['string'] },
{ open: 'r\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'R\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'u\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'U\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'f\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'F\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'b\"', close: '\"', notIn: ['string', 'comment'] },
{ open: 'B\"', close: '\"', notIn: ['string', 'comment'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'r\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'R\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'u\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'U\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'f\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'F\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'b\'', close: '\'', notIn: ['string', 'comment'] },
{ open: 'B\'', close: '\'', notIn: ['string', 'comment'] },
{ open: '`', close: '`', notIn: ['string'] }
],
}));
}
}
const mode = new PythonMode();
usingCursor({
text: [
'foo\'hello\''
],
languageIdentifier: mode.getLanguageIdentifier()
}, (model, cursor) => {
assertType(model, cursor, 1, 4, '(', '(', `does not auto close @ (1, 4)`);
});
mode.dispose();
});
test('issue #78975 - Parentheses swallowing does not work when parentheses are inserted by autocomplete', () => {
let mode = new AutoClosingMode();
usingCursor({

View File

@@ -91,7 +91,8 @@ function doCreateTest(description: string, inputStr: string, expectedStr: string
isFromEmptySelection: false,
multicursorText: null,
text: '',
html: undefined
html: undefined,
mode: null
};
},
getScreenReaderContent: (currentState: TextAreaState): TextAreaState => {

View File

@@ -41,6 +41,7 @@ export class TestConfiguration extends CommonEditorConfiguration {
typicalFullwidthCharacterWidth: 20,
canUseHalfwidthRightwardsArrow: true,
spaceWidth: 10,
middotWidth: 10,
maxDigitWidth: 10,
}, true);
}

View File

@@ -648,6 +648,18 @@ suite('Editor Model - TextModel', () => {
]);
});
test('issue #84217: Broken indentation detection', () => {
assertGuess(true, 4, [
'def main():',
' print(\'hello\')',
]);
assertGuess(true, 4, [
'def main():',
' with open(\'foo\') as fp:',
' print(fp.read())',
]);
});
test('validatePosition', () => {
let m = TextModel.createFromString('line one\nline two');

View File

@@ -10,7 +10,7 @@ import { Range } from 'vs/editor/common/core/range';
import { TokenizationResult2 } from 'vs/editor/common/core/token';
import { IFoundBracket } from 'vs/editor/common/model';
import { TextModel } from 'vs/editor/common/model/textModel';
import { ITokenizationSupport, LanguageId, LanguageIdentifier, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/modes';
import { ITokenizationSupport, LanguageId, LanguageIdentifier, MetadataConsts, TokenizationRegistry, StandardTokenType } from 'vs/editor/common/modes';
import { CharacterPair } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
@@ -335,6 +335,76 @@ suite('TextModelWithTokens', () => {
model.dispose();
registration.dispose();
});
test('issue #88075: TypeScript brace matching is incorrect in `${}` strings', () => {
const mode = new LanguageIdentifier('testMode', 3);
const otherMetadata = (
(mode.id << MetadataConsts.LANGUAGEID_OFFSET)
| (StandardTokenType.Other << MetadataConsts.TOKEN_TYPE_OFFSET)
) >>> 0;
const stringMetadata = (
(mode.id << MetadataConsts.LANGUAGEID_OFFSET)
| (StandardTokenType.String << MetadataConsts.TOKEN_TYPE_OFFSET)
) >>> 0;
const tokenizationSupport: ITokenizationSupport = {
getInitialState: () => NULL_STATE,
tokenize: undefined!,
tokenize2: (line, state) => {
switch (line) {
case 'function hello() {': {
const tokens = new Uint32Array([
0, otherMetadata
]);
return new TokenizationResult2(tokens, state);
}
case ' console.log(`${100}`);': {
const tokens = new Uint32Array([
0, otherMetadata,
16, stringMetadata,
19, otherMetadata,
22, stringMetadata,
24, otherMetadata,
]);
return new TokenizationResult2(tokens, state);
}
case '}': {
const tokens = new Uint32Array([
0, otherMetadata
]);
return new TokenizationResult2(tokens, state);
}
}
throw new Error(`Unexpected`);
}
};
const registration1 = TokenizationRegistry.register(mode.language, tokenizationSupport);
const registration2 = LanguageConfigurationRegistry.register(mode, {
brackets: [
['{', '}'],
['[', ']'],
['(', ')']
],
});
const model = TextModel.createFromString([
'function hello() {',
' console.log(`${100}`);',
'}'
].join('\n'), undefined, mode);
model.forceTokenization(1);
model.forceTokenization(2);
model.forceTokenization(3);
assert.deepEqual(model.matchBracket(new Position(2, 23)), null);
assert.deepEqual(model.matchBracket(new Position(2, 20)), null);
model.dispose();
registration1.dispose();
registration2.dispose();
});
});

View File

@@ -209,4 +209,11 @@ suite('Editor Modes - Link Computer', () => {
' https://portal.azure.com '
);
});
test('issue #86358: URL wrong recognition pattern', () => {
assertLink(
'POST|https://portal.azure.com|2019-12-05|',
' https://portal.azure.com '
);
});
});

View File

@@ -39,6 +39,7 @@ suite('viewLineRenderer.renderLine', () => {
tabSize,
0,
0,
0,
-1,
'none',
false,
@@ -90,6 +91,7 @@ suite('viewLineRenderer.renderLine', () => {
tabSize,
0,
0,
0,
-1,
'none',
false,
@@ -144,6 +146,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
6,
'boundary',
false,
@@ -237,6 +240,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'boundary',
false,
@@ -301,6 +305,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -365,6 +370,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -406,6 +412,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -438,6 +445,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -540,6 +548,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -580,6 +589,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -611,6 +621,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -659,6 +670,7 @@ suite('viewLineRenderer.renderLine', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -742,6 +754,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
renderWhitespace,
false,
@@ -769,6 +782,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -810,6 +824,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -1226,6 +1241,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
'none',
false,
@@ -1268,6 +1284,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
'all',
false,
@@ -1302,6 +1319,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
'all',
false,
@@ -1337,6 +1355,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
-1,
'all',
false,
@@ -1368,6 +1387,7 @@ suite('viewLineRenderer.renderLine 2', () => {
2,
0,
10,
10,
10000,
'none',
false,
@@ -1403,6 +1423,7 @@ suite('viewLineRenderer.renderLine 2', () => {
2,
0,
10,
10,
10000,
'none',
false,
@@ -1438,6 +1459,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1470,6 +1492,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1501,6 +1524,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'all',
false,
@@ -1538,6 +1562,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1569,6 +1594,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1602,6 +1628,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1634,6 +1661,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'boundary',
false,
@@ -1664,6 +1692,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1698,6 +1727,7 @@ suite('viewLineRenderer.renderLine 2', () => {
4,
0,
10,
10,
10000,
'none',
false,
@@ -1728,6 +1758,7 @@ suite('viewLineRenderer.renderLine 2', () => {
tabSize,
0,
10,
10,
-1,
'none',
false,

View File

@@ -57,6 +57,7 @@ function getLineBreakData(factory: ILineBreaksComputerFactory, tabSize: number,
typicalFullwidthCharacterWidth: 14,
canUseHalfwidthRightwardsArrow: true,
spaceWidth: 7,
middotWidth: 7,
maxDigitWidth: 7
}, false);
const lineBreaksComputer = factory.createLineBreaksComputer(fontInfo, tabSize, breakAfter, wrappingIndent);