Skip to content

Commit eb85f38

Browse files
committed
Address review comments
1 parent fb90252 commit eb85f38

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

packages/completion-theme/src/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
ICompletionTheme,
1212
ILSPCompletionThemeManager,
1313
PLUGIN_ID,
14-
COMPLETER_THEME_PREFIX
14+
COMPLETER_THEME_PREFIX,
15+
KernelKind
1516
} from './types';
1617
import { render_themes_list } from './about';
1718
import '../style/index.css';
@@ -37,9 +38,7 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
3738
return this.themeManager.isLight(current);
3839
}
3940

40-
get_icons_set(
41-
theme: ICompletionTheme
42-
): Map<keyof ICompletionIconSet, LabIcon> {
41+
get_iconset(theme: ICompletionTheme): Map<keyof ICompletionIconSet, LabIcon> {
4342
const icons_sets = theme.icons;
4443
const dark_mode_and_dark_supported =
4544
!this.is_theme_light() && typeof icons_sets.dark !== 'undefined';
@@ -70,7 +69,7 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
7069
if (this.current_theme === null) {
7170
return;
7271
}
73-
this.current_icons = this.get_icons_set(this.current_theme);
72+
this.current_icons = this.get_iconset(this.current_theme);
7473
}
7574

7675
get_icon(type: string): LabIcon {
@@ -85,7 +84,7 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
8584
if (this.current_icons.has(type)) {
8685
return this.current_icons.get(type).bindprops(options);
8786
}
88-
if (type === 'Kernel') {
87+
if (type === KernelKind) {
8988
return kernelIcon;
9089
}
9190
return null;
@@ -140,7 +139,7 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
140139
body: render_themes_list({
141140
themes: [...this.themes.values()],
142141
current: this.current_theme,
143-
get_set: this.get_icons_set.bind(this)
142+
get_set: this.get_iconset.bind(this)
144143
}),
145144
buttons: [Dialog.okButton()]
146145
}).catch(console.warn);
@@ -158,15 +157,16 @@ export const COMPLETION_THEME_MANAGER: JupyterFrontEndPlugin<ILSPCompletionTheme
158157
commandPalette: ICommandPalette
159158
) => {
160159
let manager = new CompletionThemeManager(themeManager);
161-
app.commands.addCommand('lsp-completer-about-themes', {
160+
const command_id = 'lsp:completer-about-themes';
161+
app.commands.addCommand(command_id, {
162162
label: 'Display the completer themes',
163163
execute: () => {
164164
manager.display_themes();
165165
}
166166
});
167167
commandPalette.addItem({
168168
category: LSP_CATEGORY,
169-
command: 'lsp-completer-about-themes'
169+
command: command_id
170170
});
171171
return manager;
172172
},

packages/completion-theme/src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ type requiredIcons = {
4343
[key in CompletionItemKindStrings]: SvgString;
4444
};
4545

46+
export const KernelKind = 'Kernel';
47+
4648
export interface ICompletionIconSet extends requiredIcons {
47-
Kernel?: SvgString;
49+
[KernelKind]?: SvgString;
4850
}
4951

5052
export interface ILicenseInfo {
@@ -111,7 +113,7 @@ export interface ILSPCompletionThemeManager {
111113

112114
register_theme(theme: ICompletionTheme): void;
113115

114-
get_icons_set(
116+
get_iconset(
115117
theme: ICompletionTheme
116118
): Map<keyof ICompletionIconSet, LabIcon.ILabIcon>;
117119
}

packages/jupyterlab-lsp/src/features/completion/completion.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export class CompletionLabIntegration implements IFeatureLabIntegration {
8585
manager: ILSPAdapterManager,
8686
adapter: WidgetAdapter<IDocumentWidget>
8787
) {
88-
console.log('ADAPTER CHANGED TO ', adapter);
8988
if (this.current_adapter) {
9089
// disconnect signals from the old adapter
9190
this.current_adapter.activeEditorChanged.disconnect(

packages/jupyterlab-lsp/src/features/completion/completion_handler.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ import ICompletionItemsResponseType = CompletionHandler.ICompletionItemsResponse
2222
import { CodeCompletion as LSPCompletionSettings } from '../../_completion';
2323
import { FeatureSettings } from '../../feature';
2424
import { PositionConverter } from '../../converter';
25-
import { ILSPCompletionThemeManager } from '@krassowski/completion-theme/lib/types';
25+
import {
26+
ILSPCompletionThemeManager,
27+
KernelKind
28+
} from '@krassowski/completion-theme/lib/types';
2629
import { LabIcon } from '@jupyterlab/ui-components';
2730

2831
/**
@@ -291,7 +294,7 @@ export class LSPConnector
291294
return undefined;
292295
}
293296
if (typeof type === 'undefined' || type == '<unknown>') {
294-
type = 'Kernel';
297+
type = KernelKind;
295298
}
296299
return (this.options.icons_manager.get_icon(type) as LabIcon) || undefined;
297300
}

packages/theme-material/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export const plugin: JupyterFrontEndPlugin<void> = {
8080
// components, reusing these plugins.
8181
id: '@krassowski/theme-material',
8282
requires: [ILSPCompletionThemeManager],
83-
activate: (app, iconsManager: ILSPCompletionThemeManager) => {
84-
iconsManager.register_theme(completionTheme);
83+
activate: (app, completionThemeManager: ILSPCompletionThemeManager) => {
84+
completionThemeManager.register_theme(completionTheme);
8585
},
8686
autoStart: true
8787
};

packages/theme-vscode/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ const completionTheme: ICompletionTheme = {
134134
export const plugin: JupyterFrontEndPlugin<void> = {
135135
id: '@krassowski/theme-vscode',
136136
requires: [ILSPCompletionThemeManager],
137-
activate: (app, iconsManager: ILSPCompletionThemeManager) => {
138-
iconsManager.register_theme(completionTheme);
137+
activate: (app, completionThemeManager: ILSPCompletionThemeManager) => {
138+
completionThemeManager.register_theme(completionTheme);
139139
},
140140
autoStart: true
141141
};

0 commit comments

Comments
 (0)