Skip to content

Commit c1b16a3

Browse files
authored
Merge pull request microsoft#155974 from justschen/justin/CodeActionMenu-Widget
Code Action Widget to fit color themes (microsoft#155907 and microsoft#155892)
2 parents 0bdda74 + 1b8e06a commit c1b16a3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export interface ICodeActionMenuTemplateData {
9090
}
9191

9292
const TEMPLATE_ID = 'codeActionWidget';
93-
const codeActionLineHeight = 27;
93+
const codeActionLineHeight = 26;
9494

9595
class CodeMenuRenderer implements IListRenderer<ICodeActionMenuItem, ICodeActionMenuTemplateData> {
9696
get templateId(): string { return TEMPLATE_ID; }
@@ -222,6 +222,8 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
222222
);
223223

224224
renderDisposables.add(this.codeActionList.value.onDidChangeSelection(e => this._onListSelection(e)));
225+
renderDisposables.add(this._editor.onDidLayoutChange(e => this.hideCodeActionWidget()));
226+
225227

226228
// Populating the list widget and tracking enabled options.
227229
inputArray.forEach((item, index) => {
@@ -257,7 +259,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
257259
const maxWidth = Math.max(...arr);
258260

259261
// 40 is the additional padding for the list widget (20 left, 20 right)
260-
renderMenu.style.width = maxWidth + 40 + 'px';
262+
renderMenu.style.width = maxWidth + 52 + 'px';
261263
this.codeActionList.value?.layout(height, maxWidth);
262264

263265
// List selection

src/vs/editor/contrib/codeAction/browser/media/action.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
.codeActionMenuWidget {
7-
padding: 10px 0px 10px 0px;
7+
padding: 8px 0px 8px 0px;
88
overflow: auto;
99
font-size: 13px;
1010
border-radius: 5px;
@@ -14,10 +14,10 @@
1414
/* flex-direction: column;
1515
flex: 0 1 auto; */
1616
width: 100%;
17-
border-style: solid;
18-
border-width: 1px;
19-
border-color: var(--vscode-editorSuggestWidget-border);
20-
background-color: var(--vscode-editorSuggestWidget-background);
17+
border-width: 0px;
18+
border-color: none;
19+
background-color: var(--vscode-menu-background);
20+
color: var(--vscode-menu-foreground);
2121
}
2222

2323
.codeActionMenuWidget .monaco-list:not(.element-focused):focus:before {
@@ -41,7 +41,6 @@
4141
-ms-user-select: none;
4242
border: none !important;
4343
border-width: 0px !important;
44-
color: var(red) !important;
4544
}
4645

4746
/* .codeActionMenuWidget .monaco-list:not(.element-focus) {
@@ -62,7 +61,7 @@
6261
display: flex;
6362
-mox-box-sizing: border-box;
6463
box-sizing: border-box;
65-
padding: 0px 20px 0px 20px;
64+
padding: 0px 26px 0px 26px;
6665
background-repeat: no-repeat;
6766
background-position: 2px 2px;
6867
white-space: nowrap;
@@ -74,6 +73,7 @@
7473

7574
.codeActionMenuWidget .monaco-list .monaco-list-row:hover:not(.option-disabled),
7675
.codeActionMenuWidget .monaco-list .moncao-list-row.focused:not(.option-disabled) {
76+
color: var(--vscode-menu-selectionForeground) !important;
7777
background-color: var(--vscode-menu-selectionBackground) !important;
7878
}
7979

@@ -86,7 +86,7 @@
8686
-moz-user-select: none;
8787
-ms-user-select: none;
8888
user-select: none;
89-
color: var(--vscode-list-inactiveSelectionBackground) !important;
89+
color: var(--vscode-disabledForeground) !important;
9090
}
9191

9292
.codeActionMenuWidget .monaco-list .separator {

0 commit comments

Comments
 (0)