When I start JupyterLab the console states that the extension failed to start and there is “No provider for: etc-jupyterlab-aws-api-s3-handler:AWSAPIGatewayHandler.” However, I know I have installed the extension that provides the Token named etc-jupyterlab-aws-api-s3-handler:AWSAPIGatewayHandler, as I can see it start up.
It would be great if there were a simple Hello World example of an extension that provides a Service. Is there something like this? I looked at the File Browser example, as advised in the documentation, but I’m still struggling to get it working.
This is the repo I am working on: GitHub - educational-technology-collective/etc-jupyterlab-aws-api-s3-handler
1 Like
I guess one relatively self-contained example is theme-manager and theme-material in LSP extension, but it has a bit exotic organisation of the source code so possibly not a good example
export const plugin: JupyterFrontEndPlugin<void> = {
// while for now it only styles completion,
// we may decide to allow styling of more
// components, reusing these plugins.
id: '@krassowski/theme-material',
requires: [ILSPCompletionThemeManager],
activate: (app, completionThemeManager: ILSPCompletionThemeManager) => {
completionThemeManager.register_theme(completionTheme);
},
autoStart: true
};
export interface ILSPCompletionThemeManager {
get_icon(type: string): LabIcon.ILabIcon | null;
set_theme(theme_id: string | null): void;
register_theme(theme: ICompletionTheme): void;
get_iconset(
theme: ICompletionTheme
): Map<keyof ICompletionIconSet, LabIcon.ILabIcon>;
set_icons_overrides(
map: Record<string, CompletionItemKindStrings | 'Kernel'>
): void;
}
export const ILSPCompletionThemeManager = new Token<ILSPCompletionThemeManager>(
PLUGIN_ID + ':ILSPCompletionThemeManager'
);
import {
COMPLETER_THEME_PREFIX,
CompletionItemKindStrings,
ICompletionIconSet,
ICompletionTheme,
ILSPCompletionThemeManager,
KernelKind,
PLUGIN_ID
} from './types';
export class CompletionThemeManager implements ILSPCompletionThemeManager {
protected current_icons: Map<string, LabIcon>;
protected themes: Map<string, ICompletionTheme>;
private current_theme_id: string;
private icons_cache: Map<string, LabIcon>;
private icon_overrides: Map<string, CompletionItemKindStrings>;
private trans: TranslationBundle;
constructor(protected themeManager: IThemeManager, trans: TranslationBundle) {
this.themes = new Map();
This file has been truncated. show original
export const COMPLETION_THEME_MANAGER: JupyterFrontEndPlugin<ILSPCompletionThemeManager> = {
id: PLUGIN_ID,
requires: [IThemeManager, ICommandPalette, ITranslator],
activate: (
app,
themeManager: IThemeManager,
commandPalette: ICommandPalette,
translator: ITranslator
) => {
const trans = translator.load('jupyterlab-lsp');
let manager = new CompletionThemeManager(themeManager, trans);
const command_id = 'lsp:completer-about-themes';
app.commands.addCommand(command_id, {
label: trans.__('Display the completer themes'),
execute: () => {
manager.display_themes();
}
});
commandPalette.addItem({
category: LSP_CATEGORY,
This file has been truncated. show original
I figured this out - I’ll work on creating one of these when I get a chance - let me know if anyone needs guidance on this.
How to Solve It (1945) is a small volume by mathematician George Pólya describing methods of problem solving.
How to Solve It suggests the following steps when solving a mathematical problem:
If this technique fails, Pólya advises: "If you can't solve a problem, then there is an easier problem you can solve: find it." Or: "If you cannot solve the proposed problem, try to solve first some related problem. Could you imagine a more accessible related problem?"
"Understand the problem" is often n...