提交 4925df27 编写于 作者: J Joao Moreno

Merge commit 'refs/pull/60051/head' of github.com:Microsoft/vscode into pr/60051

......@@ -720,6 +720,11 @@ declare module 'vscode' {
* An event signaling when the selection state changes.
*/
readonly onDidChangeSelection: Event<boolean>;
/**
* Whether the input box is hidden.
*/
hideInputBox: boolean;
}
//#endregion
......
......@@ -119,6 +119,7 @@ class MainThreadSCMProvider implements ISCMProvider {
get acceptInputCommand(): Command | undefined { return this.features.acceptInputCommand; }
get statusBarCommands(): Command[] | undefined { return this.features.statusBarCommands; }
get count(): number | undefined { return this.features.count; }
get hideInputBox(): boolean | undefined { return this.features.hideInputBox; }
private _onDidChangeCommitTemplate = new Emitter<string>();
get onDidChangeCommitTemplate(): Event<string> { return this._onDidChangeCommitTemplate.event; }
......
......@@ -535,6 +535,7 @@ export interface SCMProviderFeatures {
commitTemplate?: string;
acceptInputCommand?: modes.Command;
statusBarCommands?: modes.Command[];
hideInputBox?: boolean;
}
export interface SCMGroupFeatures {
......
......@@ -439,6 +439,17 @@ class ExtHostSourceControl implements vscode.SourceControl {
return this._selected;
}
private _hideInputBox: boolean = false;
get hideInputBox(): boolean {
return this._hideInputBox;
}
set hideInputBox(hideInputBox: boolean | undefined) {
this._hideInputBox = hideInputBox;
this._proxy.$updateSourceControl(this.handle, { hideInputBox: !!hideInputBox });
}
private _onDidChangeSelection = new Emitter<boolean>();
readonly onDidChangeSelection = this._onDidChangeSelection.event;
......
......@@ -814,6 +814,7 @@ export class RepositoryPanel extends ViewletPanel {
this.disposables.push(focusTracker);
// Input
if (!this.repository.provider.hideInputBox) {
this.inputBoxContainer = append(container, $('.scm-editor'));
const updatePlaceholder = () => {
......@@ -864,6 +865,7 @@ export class RepositoryPanel extends ViewletPanel {
}
this.updateInputBox();
}
// List
......@@ -918,20 +920,24 @@ export class RepositoryPanel extends ViewletPanel {
}
this.cachedHeight = height;
if (this.inputBox) {
this.inputBox.layout();
}
const editorHeight = this.inputBox.height;
const listHeight = height - (editorHeight + 12 /* margin */);
const editorHeight = this.inputBox ? this.inputBox.height : 0;
const listHeight = height - (editorHeight + (editorHeight ? 12 : 0) /* margin */);
this.listContainer.style.height = `${listHeight}px`;
this.list.layout(listHeight);
if (this.inputBoxContainer) {
toggleClass(this.inputBoxContainer, 'scroll', editorHeight >= 134);
}
}
focus(): void {
super.focus();
if (this.isExpanded()) {
if (this.isExpanded() && this.inputBox) {
this.inputBox.focus();
}
}
......@@ -991,7 +997,7 @@ export class RepositoryPanel extends ViewletPanel {
}
private updateInputBox(): void {
if (typeof this.repository.provider.commitTemplate === 'undefined' || this.inputBox.value) {
if (typeof this.repository.provider.commitTemplate === 'undefined' || !this.inputBox || this.inputBox.value) {
return;
}
......
......@@ -63,6 +63,8 @@ export interface ISCMProvider extends IDisposable {
readonly statusBarCommands?: Command[];
readonly onDidChange: Event<void>;
readonly hideInputBox?: boolean | undefined;
getOriginalResource(uri: URI): TPromise<URI>;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册