diff --git a/packages/jupyter-ai/src/completions/plugin.ts b/packages/jupyter-ai/src/completions/plugin.ts index b7286a785..5826426e9 100644 --- a/packages/jupyter-ai/src/completions/plugin.ts +++ b/packages/jupyter-ai/src/completions/plugin.ts @@ -2,9 +2,7 @@ import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'; -import { - ICompletionProviderManager, -} from '@jupyterlab/completer'; +import { ICompletionProviderManager } from '@jupyterlab/completer'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; import { IEditorLanguageRegistry, @@ -20,7 +18,7 @@ export namespace CommandIDs { * Command to toggle completions globally. */ export const toggleCompletions = 'jupyter-ai:toggle-completions'; - /** + /** * Command to toggle completions for specific language. */ export const toggleLanguageCompletions = diff --git a/packages/jupyter-ai/src/completions/provider.ts b/packages/jupyter-ai/src/completions/provider.ts index 4deb714c7..12d3031e0 100644 --- a/packages/jupyter-ai/src/completions/provider.ts +++ b/packages/jupyter-ai/src/completions/provider.ts @@ -7,6 +7,8 @@ import { InlineCompletionTriggerKind, IInlineCompletionProvider, IInlineCompletionContext, + IInlineCompletionList, + IInlineCompletionItem, CompletionHandler } from '@jupyterlab/completer'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; @@ -24,7 +26,6 @@ import { getEditor } from '../selection-watcher'; import { IJupyternautStatus } from '../tokens'; import { CompletionWebsocketHandler } from './handler'; - type StreamChunk = AiService.InlineCompletionStreamChunk; /** @@ -53,7 +54,7 @@ export class JupyterAIInlineProvider implements IInlineCompletionProvider { options.completionHandler.streamed.connect(this._receiveStreamChunk, this); } - get name() { + get name(): string { if (this._currentModel.length > 0) { return `JupyterAI (${this._currentModel})`; } else { @@ -65,7 +66,7 @@ export class JupyterAIInlineProvider implements IInlineCompletionProvider { async fetch( request: CompletionHandler.IRequest, context: IInlineCompletionContext - ) { + ): Promise> { const mime = request.mimeType ?? 'text/plain'; const language = this.options.languageRegistry.findByMIME(mime); if (!language) { @@ -139,7 +140,7 @@ export class JupyterAIInlineProvider implements IInlineCompletionProvider { /** * Stream a reply for completion identified by given `token`. */ - async *stream(token: string) { + async *stream(token: string): AsyncGenerator { let done = false; while (!done) { const delegate = new PromiseDelegate(); @@ -203,7 +204,7 @@ export class JupyterAIInlineProvider implements IInlineCompletionProvider { return this._settings.enabled; } - isLanguageEnabled(language: string) { + isLanguageEnabled(language: string): boolean { return !this._settings.disabledLanguages.includes(language); } @@ -258,8 +259,7 @@ export class JupyterAIInlineProvider implements IInlineCompletionProvider { } if (language.name === 'ipython') { return 'python'; - } - else if (language.name === 'ipythongfm') { + } else if (language.name === 'ipythongfm') { return 'markdown'; } return language.name; diff --git a/packages/jupyter-ai/src/status.ts b/packages/jupyter-ai/src/status.ts index a1a0b69ea..013b305d7 100644 --- a/packages/jupyter-ai/src/status.ts +++ b/packages/jupyter-ai/src/status.ts @@ -10,7 +10,7 @@ export const jupyternautStatus: JupyterFrontEndPlugin = { id: 'jupyter_ai:jupyternaut-status', description: 'Adds a status indicator for jupyternaut.', autoStart: true, - optional: [IStatusBar], + requires: [IStatusBar], provides: IJupyternautStatus, activate: (app: JupyterFrontEnd, statusBar: IStatusBar | null) => { const indicator = new JupyternautStatus({ commandRegistry: app.commands });