diff --git a/src/vs/workbench/contrib/terminal/test/browser/links/terminalProtocolLinkProvider.test.ts b/src/vs/workbench/contrib/terminal/test/browser/links/terminalProtocolLinkProvider.test.ts index 81609a8a1a3..5c31a694cd7 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/links/terminalProtocolLinkProvider.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/links/terminalProtocolLinkProvider.test.ts @@ -76,4 +76,11 @@ suite('Workbench - TerminalWebLinkProvider', () => { await assertLink('POST|https://portal.azure.com|2019-12-05|', [{ range: [[6, 1], [29, 1]], text: 'https://portal.azure.com' }]); await assertLink('aa https://foo.bar/[this is foo site] aa', [{ range: [[5, 1], [38, 1]], text: 'https://foo.bar/[this is foo site]' }]); }); + + test('should support multiple link results', async () => { + await assertLink('http://foo.bar http://bar.foo', [ + { range: [[1, 1], [14, 1]], text: 'http://foo.bar' }, + { range: [[16, 1], [29, 1]], text: 'http://bar.foo' } + ]); + }); }); diff --git a/src/vs/workbench/contrib/terminal/test/browser/links/terminalValidatedLocalLinkProvider.test.ts b/src/vs/workbench/contrib/terminal/test/browser/links/terminalValidatedLocalLinkProvider.test.ts index 69cb51f6be9..23f81babf84 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/links/terminalValidatedLocalLinkProvider.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/links/terminalValidatedLocalLinkProvider.test.ts @@ -149,4 +149,11 @@ suite('Workbench - TerminalValidatedLocalLinkProvider', () => { await assertLink(`+++ b/foo/bar`, OperatingSystem.Linux, [{ text: 'foo/bar', range: [[7, 1], [13, 1]] }]); }); }); + + test('should support multiple link results', async () => { + await assertLink('./foo ./bar', OperatingSystem.Linux, [ + { range: [[1, 1], [5, 1]], text: './foo' }, + { range: [[7, 1], [11, 1]], text: './bar' } + ]); + }); }); diff --git a/src/vs/workbench/contrib/terminal/test/browser/links/terminalWordLinkProvider.test.ts b/src/vs/workbench/contrib/terminal/test/browser/links/terminalWordLinkProvider.test.ts index 0b5e679b21d..4927a1cbc37 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/links/terminalWordLinkProvider.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/links/terminalWordLinkProvider.test.ts @@ -21,7 +21,7 @@ suite('Workbench - TerminalWordLinkProvider', () => { instantiationService.stub(IConfigurationService, configurationService); }); - async function assertLink2(text: string, expected: { text: string, range: [number, number][] }[]) { + async function assertLink(text: string, expected: { text: string, range: [number, number][] }[]) { const xterm = new Terminal(); const provider: TerminalWordLinkProvider = instantiationService.createInstance(TerminalWordLinkProvider, xterm, () => { }, () => { }); @@ -47,28 +47,36 @@ suite('Workbench - TerminalWordLinkProvider', () => { test('should link words as defined by wordSeparators', async () => { await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' ()[]' } }); - await assertLink2('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]); - await assertLink2('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]); - await assertLink2(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); - await assertLink2('(foo)', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); - await assertLink2('[foo]', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); - await assertLink2('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]); + await assertLink('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]); + await assertLink('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]); + await assertLink(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); + await assertLink('(foo)', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); + await assertLink('[foo]', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); + await assertLink('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]); await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' ' } }); - await assertLink2('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]); - await assertLink2(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); - await assertLink2('(foo)', [{ range: [[1, 1], [5, 1]], text: '(foo)' }]); - await assertLink2('[foo]', [{ range: [[1, 1], [5, 1]], text: '[foo]' }]); - await assertLink2('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]); + await assertLink('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]); + await assertLink(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]); + await assertLink('(foo)', [{ range: [[1, 1], [5, 1]], text: '(foo)' }]); + await assertLink('[foo]', [{ range: [[1, 1], [5, 1]], text: '[foo]' }]); + await assertLink('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]); }); test('should support wide characters', async () => { await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' []' } }); - await assertLink2('aabbccdd.txt ', [{ range: [[1, 1], [12, 1]], text: 'aabbccdd.txt' }]); - await assertLink2('我是学生.txt ', [{ range: [[1, 1], [12, 1]], text: '我是学生.txt' }]); - await assertLink2(' aabbccdd.txt ', [{ range: [[2, 1], [13, 1]], text: 'aabbccdd.txt' }]); - await assertLink2(' 我是学生.txt ', [{ range: [[2, 1], [13, 1]], text: '我是学生.txt' }]); - await assertLink2(' [aabbccdd.txt] ', [{ range: [[3, 1], [14, 1]], text: 'aabbccdd.txt' }]); - await assertLink2(' [我是学生.txt] ', [{ range: [[3, 1], [14, 1]], text: '我是学生.txt' }]); + await assertLink('aabbccdd.txt ', [{ range: [[1, 1], [12, 1]], text: 'aabbccdd.txt' }]); + await assertLink('我是学生.txt ', [{ range: [[1, 1], [12, 1]], text: '我是学生.txt' }]); + await assertLink(' aabbccdd.txt ', [{ range: [[2, 1], [13, 1]], text: 'aabbccdd.txt' }]); + await assertLink(' 我是学生.txt ', [{ range: [[2, 1], [13, 1]], text: '我是学生.txt' }]); + await assertLink(' [aabbccdd.txt] ', [{ range: [[3, 1], [14, 1]], text: 'aabbccdd.txt' }]); + await assertLink(' [我是学生.txt] ', [{ range: [[3, 1], [14, 1]], text: '我是学生.txt' }]); + }); + + test('should support multiple link results', async () => { + await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' ' } }); + await assertLink('foo bar', [ + { range: [[1, 1], [3, 1]], text: 'foo' }, + { range: [[5, 1], [7, 1]], text: 'bar' } + ]); }); });