Merge from vscode 6268feb42ba4f2e2fa15484e88c9af60d254998c (#6530)

This commit is contained in:
Anthony Dresser
2019-07-29 21:03:02 -07:00
committed by GitHub
parent 2c8a22bb0d
commit 6db84eefa3
104 changed files with 1797 additions and 3740 deletions

View File

@@ -40,7 +40,7 @@ export class MainThreadConsole implements MainThreadConsoleShape {
// Log on main side if running tests from cli
if (this._isExtensionDevTestFromCli) {
this._windowsService.log(entry.severity, ...parse(entry).args);
this._windowsService.log(entry.severity, parse(entry).args);
}
// Broadcast to other windows if we are in development mode

View File

@@ -51,21 +51,21 @@ export class TextEditorEdit {
private readonly _document: vscode.TextDocument;
private readonly _documentVersionId: number;
private _collectedEdits: ITextEditOperation[];
private _setEndOfLine: EndOfLine | undefined;
private readonly _undoStopBefore: boolean;
private readonly _undoStopAfter: boolean;
private _collectedEdits: ITextEditOperation[] = [];
private _setEndOfLine: EndOfLine | undefined = undefined;
private _finalized: boolean = false;
constructor(document: vscode.TextDocument, options: { undoStopBefore: boolean; undoStopAfter: boolean; }) {
this._document = document;
this._documentVersionId = document.version;
this._collectedEdits = [];
this._setEndOfLine = undefined;
this._undoStopBefore = options.undoStopBefore;
this._undoStopAfter = options.undoStopAfter;
}
finalize(): IEditData {
this._finalized = true;
return {
documentVersionId: this._documentVersionId,
edits: this._collectedEdits,
@@ -75,7 +75,14 @@ export class TextEditorEdit {
};
}
private _throwIfFinalized() {
if (this._finalized) {
throw new Error('Edit is only valid while callback runs');
}
}
replace(location: Position | Range | Selection, value: string): void {
this._throwIfFinalized();
let range: Range | null = null;
if (location instanceof Position) {
@@ -90,10 +97,12 @@ export class TextEditorEdit {
}
insert(location: Position, value: string): void {
this._throwIfFinalized();
this._pushEdit(new Range(location, location), value, true);
}
delete(location: Range | Selection): void {
this._throwIfFinalized();
let range: Range | null = null;
if (location instanceof Range) {
@@ -115,6 +124,7 @@ export class TextEditorEdit {
}
setEndOfLine(endOfLine: EndOfLine): void {
this._throwIfFinalized();
if (endOfLine !== EndOfLine.LF && endOfLine !== EndOfLine.CRLF) {
throw illegalArgument('endOfLine');
}

View File

@@ -582,11 +582,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
}
// Get the initial cwd
const terminalConfig = configProvider.getConfiguration('terminal.integrated');
const activeWorkspaceRootUri = URI.revive(activeWorkspaceRootUriComponents);
const initialCwd = terminalEnvironment.getCwd(shellLaunchConfig, os.homedir(), activeWorkspaceRootUri, terminalConfig.cwd);
// Get the environment
const apiLastActiveWorkspace = await this._extHostWorkspace.getWorkspaceFolder(activeWorkspaceRootUri);
const lastActiveWorkspace = apiLastActiveWorkspace ? {
@@ -597,6 +593,12 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
throw new Error('Not implemented');
}
} as IWorkspaceFolder : null;
// Get the initial cwd
const terminalConfig = configProvider.getConfiguration('terminal.integrated');
const initialCwd = terminalEnvironment.getCwd(shellLaunchConfig, os.homedir(), lastActiveWorkspace ? lastActiveWorkspace : undefined, this._variableResolver, activeWorkspaceRootUri, terminalConfig.cwd, this._logService);
const envFromConfig = this._apiInspectConfigToPlain(configProvider.getConfiguration('terminal.integrated').inspect<ITerminalEnvironment>(`env.${platformKey}`));
const baseEnv = terminalConfig.get<boolean>('inheritEnv', true) ? process.env as platform.IProcessEnvironment : await this._getNonInheritedEnv();
const env = terminalEnvironment.createTerminalEnvironment(