提交 6494c1c5 编写于 作者: M Matt Bierner

Adding pinning test for function treating paren as commit character

上级 24cb2220
......@@ -10,15 +10,36 @@ import { disposeAll } from '../utils/dispose';
const testDocumentUri = vscode.Uri.parse('untitled:test.ts');
const configOverrides: { readonly [key: string]: any } = Object.freeze({
'editor.suggestSelection': 'first',
'typescript.suggest.completeFunctionCalls': false,
});
suite('TypeScript Completions', () => {
const _disposables: vscode.Disposable[] = [];
let oldConfig: { [key: string]: any } = {};
setup(async () => {
await wait(100);
setup(() => {
return wait(100);
// save off config and update overrides
oldConfig = {};
const config = vscode.workspace.getConfiguration(undefined, testDocumentUri);
for (const configKey of Object.keys(configOverrides)) {
oldConfig[configKey] = config.get(configKey);
await new Promise((resolve, reject) => config.update(configKey, configOverrides[configKey], vscode.ConfigurationTarget.Global).then(() => resolve(), reject));
}
});
teardown(() => {
teardown(async () => {
disposeAll(_disposables);
// Restore config
const config = vscode.workspace.getConfiguration(undefined, testDocumentUri);
for (const configKey of Object.keys(oldConfig)) {
await new Promise((resolve, reject) => config.update(configKey, oldConfig[configKey], vscode.ConfigurationTarget.Global).then(() => resolve(), reject));
}
return vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
......@@ -52,6 +73,21 @@ suite('TypeScript Completions', () => {
));
});
test('Should treat paren as commit character for function completions', async () => {
await createTestEditor(testDocumentUri,
`function abcdef() {};`,
`ab$0;`
);
const document = await typeCommitCharacter(testDocumentUri, '(', _disposables);
assert.strictEqual(
document.getText(),
joinLines(
`function abcdef() {};`,
`abcdef();`
));
});
test('Should insert backets when completing dot properties with spaces in name', async () => {
await createTestEditor(testDocumentUri,
'const x = { "hello world": 1 };',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册