Skip to content

Commit 8b731da

Browse files
committed
Make the icon types map case-insensitive
1 parent 17775d3 commit 8b731da

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

packages/completion-theme/src/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
2323
protected themes: Map<string, ICompletionTheme>;
2424
private current_theme_id: string;
2525
private icons_cache: Map<string, LabIcon>;
26-
private icon_overrides: Record<string, CompletionItemKindStrings>;
26+
private icon_overrides: Map<string, CompletionItemKindStrings>;
2727

2828
constructor(protected themeManager: IThemeManager) {
2929
this.themes = new Map();
3030
this.icons_cache = new Map();
31-
this.icon_overrides = {};
31+
this.icon_overrides = new Map();
3232
themeManager.themeChanged.connect(this.update_icons_set, this);
3333
}
3434

@@ -81,8 +81,8 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
8181
}
8282
let options = this.current_theme.icons.options || {};
8383
if (type) {
84-
if (type in this.icon_overrides) {
85-
type = this.icon_overrides[type];
84+
if (this.icon_overrides.has(type.toLowerCase())) {
85+
type = this.icon_overrides.get(type.toLowerCase());
8686
}
8787
type =
8888
type.substring(0, 1).toUpperCase() + type.substring(1).toLowerCase();
@@ -155,7 +155,12 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
155155
set_icons_overrides(
156156
iconOverrides: Record<string, CompletionItemKindStrings>
157157
) {
158-
this.icon_overrides = iconOverrides;
158+
this.icon_overrides = new Map(
159+
Object.keys(iconOverrides).map(kernelType => [
160+
kernelType.toLowerCase(),
161+
iconOverrides[kernelType]
162+
])
163+
);
159164
}
160165
}
161166

packages/jupyterlab-lsp/schema/completion.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"typesMap": {
3636
"title": "Mapping of custom kernel types to valid completion kind names",
37-
"description": "Mapping used for icon selection. Accepted values are the names of CompletionItemKind and 'Kernel' literal. The defaults aim to provide good initial experience for Julia, Python and R kernels.",
37+
"description": "Mapping used for icon selection. The kernel types (keys) are case-insensitive. Accepted values are the names of CompletionItemKind and 'Kernel' literal. The defaults aim to provide good initial experience for Julia, Python and R kernels.",
3838
"type": "object",
3939
"default": {
4040
"<unknown>": "Kernel",

0 commit comments

Comments
 (0)