Merge from vscode e0762af258c0b20320ed03f3871a41967acc4421 (#7404)

* Merge from vscode e0762af258c0b20320ed03f3871a41967acc4421

* readd svgs
This commit is contained in:
Anthony Dresser
2019-09-27 11:13:19 -07:00
committed by GitHub
parent 6385443a4c
commit 07109617b5
348 changed files with 4219 additions and 4307 deletions

View File

@@ -310,6 +310,11 @@ configurationRegistry.registerConfiguration({
description: nls.localize('terminal.integrated.experimentalUseTitleEvent', "An experimental setting that will use the terminal title event for the dropdown title. This setting will only apply to new terminals."),
type: 'boolean',
default: false
},
'terminal.integrated.enableFileLinks': {
description: nls.localize('terminal.integrated.enableFileLinks', "Whether to enable file links in the terminal. Links can be slow when working on a network drive in particular because each file link is verified against the file system."),
type: 'boolean',
default: true
}
}
});

View File

@@ -108,7 +108,9 @@ export class TerminalLinkHandler {
this.registerWebLinkHandler();
if (this._processManager) {
this.registerLocalLinkHandler();
if (this._configHelper.config.enableFileLinks) {
this.registerLocalLinkHandler();
}
this.registerGitDiffLinkHandlers();
}
}

View File

@@ -22,11 +22,6 @@ export interface XTermCore {
};
_onIntersectionChange: any;
};
// TODO: Remove below once a synchronous write API is added
// The below are only used in tests
writeBuffer: string[];
_innerWrite(): void;
}
export interface IEventEmitter<T> {

View File

@@ -116,6 +116,7 @@ export interface ITerminalConfiguration {
windowsEnableConpty: boolean;
experimentalRefreshOnResume: boolean;
experimentalUseTitleEvent: boolean;
enableFileLinks: boolean;
}
export interface ITerminalConfigHelper {

View File

@@ -13,10 +13,8 @@ interface TestTerminal extends Terminal {
_core: XTermCore;
}
function syncWrite(term: TestTerminal, data: string): void {
// Terminal.write is asynchronous
term._core.writeBuffer.push(data);
term._core._innerWrite();
function writePromise(term: Terminal, data: string): Promise<void> {
return new Promise(r => term.write(data, r));
}
const ROWS = 10;

View File

@@ -9,6 +9,7 @@ import { TerminalLinkHandler, LineColumnInfo } from 'vs/workbench/contrib/termin
import * as strings from 'vs/base/common/strings';
import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
import { Event } from 'vs/base/common/event';
import { ITerminalConfigHelper } from 'vs/workbench/contrib/terminal/common/terminal';
class TestTerminalLinkHandler extends TerminalLinkHandler {
public get localLinkRegex(): RegExp {
@@ -62,13 +63,19 @@ interface LinkFormatInfo {
column?: string;
}
const testConfigHelper: ITerminalConfigHelper = <any>{
config: {
enableFileLinks: true
}
};
suite('Workbench - TerminalLinkHandler', () => {
suite('localLinkRegex', () => {
test('Windows', () => {
const terminalLinkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Windows,
userHome: ''
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
function testLink(link: string, linkUrl: string, lineNo?: string, columnNo?: string) {
assert.equal(terminalLinkHandler.extractLinkUrl(link), linkUrl);
assert.equal(terminalLinkHandler.extractLinkUrl(`:${link}:`), linkUrl);
@@ -144,7 +151,7 @@ suite('Workbench - TerminalLinkHandler', () => {
const terminalLinkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Linux,
userHome: ''
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
function testLink(link: string, linkUrl: string, lineNo?: string, columnNo?: string) {
assert.equal(terminalLinkHandler.extractLinkUrl(link), linkUrl);
assert.equal(terminalLinkHandler.extractLinkUrl(`:${link}:`), linkUrl);
@@ -212,7 +219,7 @@ suite('Workbench - TerminalLinkHandler', () => {
const linkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Windows,
userHome: 'C:\\Users\\Me'
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
linkHandler.processCwd = 'C:\\base';
assert.equal(linkHandler.preprocessPath('./src/file1'), 'C:\\base\\src\\file1');
@@ -225,7 +232,7 @@ suite('Workbench - TerminalLinkHandler', () => {
const linkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Windows,
userHome: 'C:\\Users\\M e'
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
linkHandler.processCwd = 'C:\\base dir';
assert.equal(linkHandler.preprocessPath('./src/file1'), 'C:\\base dir\\src\\file1');
@@ -239,7 +246,7 @@ suite('Workbench - TerminalLinkHandler', () => {
const linkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Linux,
userHome: '/home/me'
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
linkHandler.processCwd = '/base';
assert.equal(linkHandler.preprocessPath('./src/file1'), '/base/src/file1');
@@ -252,7 +259,7 @@ suite('Workbench - TerminalLinkHandler', () => {
const linkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Linux,
userHome: '/home/me'
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
assert.equal(linkHandler.preprocessPath('./src/file1'), null);
assert.equal(linkHandler.preprocessPath('src/file2'), null);
@@ -266,7 +273,7 @@ suite('Workbench - TerminalLinkHandler', () => {
const linkHandler = new TestTerminalLinkHandler(new TestXterm() as any, {
os: OperatingSystem.Linux,
userHome: ''
} as any, null!, null!, null!, null!, new MockTerminalInstanceService(), null!);
} as any, testConfigHelper, null!, null!, null!, new MockTerminalInstanceService(), null!);
function assertAreGoodMatches(matches: RegExpMatchArray | null) {
if (matches) {