Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to hide status bar of suggest widget #210896

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9d47bfa
Add 'Hide Status Bar' to status bar of suggest widget
gjsjohnmurray Apr 22, 2024
bd9b045
Display 'show less' on initial status bar when appropriate
gjsjohnmurray Apr 22, 2024
17ef008
Default suggest status bar visible now there is a button to hide it
gjsjohnmurray Apr 22, 2024
9a9647c
Merge branch 'main' into magenta-pike
gjsjohnmurray May 2, 2024
c860ab5
Merge branch 'main' into magenta-pike
gjsjohnmurray May 7, 2024
b11367f
Merge branch 'main' into magenta-pike
gjsjohnmurray May 8, 2024
eeed613
Merge branch 'main' into magenta-pike
gjsjohnmurray May 21, 2024
1c2c5fb
Merge branch 'main' into magenta-pike
gjsjohnmurray Jun 11, 2024
87b61df
Merge branch 'main' into magenta-pike
gjsjohnmurray Jun 19, 2024
1d18522
Merge branch 'main' into magenta-pike
gjsjohnmurray Jul 4, 2024
353dbe1
Merge branch 'main' into magenta-pike
gjsjohnmurray Jul 10, 2024
48add79
Merge branch 'main' into magenta-pike
gjsjohnmurray Jul 27, 2024
2c12fe5
Merge branch 'main' into magenta-pike
gjsjohnmurray Jul 31, 2024
f1d0573
Merge branch 'main' into magenta-pike
gjsjohnmurray Aug 12, 2024
574830a
Merge branch 'microsoft:main' into magenta-pike
gjsjohnmurray Aug 16, 2024
523100d
Merge remote-tracking branch 'upstream/main' into magenta-pike
gjsjohnmurray Sep 2, 2024
43ceb82
Merge branch 'main' into magenta-pike
gjsjohnmurray Sep 2, 2024
affc5a1
Merge branch 'main' into magenta-pike
gjsjohnmurray Sep 19, 2024
a7eac42
Merge branch 'main' into magenta-pike
gjsjohnmurray Oct 4, 2024
8981d2b
Merge branch 'main' into magenta-pike
gjsjohnmurray Nov 13, 2024
e55d0cd
Merge branch 'main' into magenta-pike
gjsjohnmurray Dec 29, 2024
d980c81
Merge branch 'main' into magenta-pike
gjsjohnmurray Jan 21, 2025
7f1f3ea
Merge branch 'main' into magenta-pike
gjsjohnmurray Feb 4, 2025
863fd32
Merge branch 'main' into magenta-pike
gjsjohnmurray Feb 7, 2025
5cb76d4
Merge branch 'main' into magenta-pike
gjsjohnmurray Feb 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vs/editor/common/config/editorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4750,7 +4750,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, ISuggestOptio
shareSuggestSelections: false,
selectionMode: 'always',
showIcons: true,
showStatusBar: false,
showStatusBar: true,
preview: false,
previewMode: 'subwordSmart',
showInlineDetails: true,
Expand Down
20 changes: 20 additions & 0 deletions src/vs/editor/contrib/suggest/browser/suggestController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import { basename, extname } from '../../../../base/common/resources.js';
import { hash } from '../../../../base/common/hash.js';
import { WindowIdleValue, getWindow } from '../../../../base/browser/dom.js';
import { ModelDecorationOptions } from '../../../common/model/textModel.js';
import { Codicon } from '../../../../base/common/codicons';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration';

// sticky suggest widget which doesn't disappear on focus out and such
const _sticky = false
Expand Down Expand Up @@ -141,6 +143,7 @@ export class SuggestController implements IEditorContribution {
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@ILogService private readonly _logService: ILogService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
) {
this.editor = editor;
this.model = _instantiationService.createInstance(SuggestModel, this.editor,);
Expand Down Expand Up @@ -749,6 +752,10 @@ export class SuggestController implements IEditorContribution {
this.widget.value.toggleDetailsFocus();
}

hideStatusBar(): void {
this._configurationService.updateValue('editor.suggest.showStatusBar', false);
}

resetWidgetSize(): void {
this.widget.value.resetPersistedSize();
}
Expand Down Expand Up @@ -1056,6 +1063,19 @@ registerEditorCommand(new SuggestCommand({
}
}));

registerEditorCommand(new SuggestCommand({
id: 'hideStatusBar',
precondition: SuggestContext.Visible,
handler: x => x.hideStatusBar(),
menuOpts: [{
menuId: suggestWidgetStatusbarMenu,
group: 'right',
order: 2,
icon: Codicon.close,
title: nls.localize('statusBar.hide', "Hide Status Bar")
}]
}));

//#region tab completions

registerEditorCommand(new SuggestCommand({
Expand Down
2 changes: 2 additions & 0 deletions src/vs/editor/contrib/suggest/browser/suggestWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export class SuggestWidget implements IDisposable {
this._disposables.add(this.editor.onDidChangeConfiguration(e => {
if (e.hasChanged(EditorOption.suggest)) {
applyStatusBarStyle();
this._layout(this.element.size); // in case status bar was hidden from its control
applyIconStyle();
}
if (this._completionModel && (e.hasChanged(EditorOption.fontInfo) || e.hasChanged(EditorOption.suggestFontSize) || e.hasChanged(EditorOption.suggestLineHeight))) {
Expand All @@ -290,6 +291,7 @@ export class SuggestWidget implements IDisposable {

this._ctxSuggestWidgetVisible = SuggestContext.Visible.bindTo(_contextKeyService);
this._ctxSuggestWidgetDetailsVisible = SuggestContext.DetailsVisible.bindTo(_contextKeyService);
this._ctxSuggestWidgetDetailsVisible.set(this._isDetailsVisible());
this._ctxSuggestWidgetMultipleSuggestions = SuggestContext.MultipleSuggestions.bindTo(_contextKeyService);
this._ctxSuggestWidgetHasFocusedSuggestion = SuggestContext.HasFocusedSuggestion.bindTo(_contextKeyService);

Expand Down