Skip to content

Commit

Permalink
Make IStatusBar required for now, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Dec 10, 2023
1 parent 6ffb553 commit 868e52b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions packages/jupyter-ai/src/completions/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 =
Expand Down
14 changes: 7 additions & 7 deletions packages/jupyter-ai/src/completions/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
InlineCompletionTriggerKind,
IInlineCompletionProvider,
IInlineCompletionContext,
IInlineCompletionList,
IInlineCompletionItem,
CompletionHandler
} from '@jupyterlab/completer';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
Expand All @@ -24,7 +26,6 @@ import { getEditor } from '../selection-watcher';
import { IJupyternautStatus } from '../tokens';
import { CompletionWebsocketHandler } from './handler';


type StreamChunk = AiService.InlineCompletionStreamChunk;

/**
Expand Down Expand Up @@ -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 {
Expand All @@ -65,7 +66,7 @@ export class JupyterAIInlineProvider implements IInlineCompletionProvider {
async fetch(
request: CompletionHandler.IRequest,
context: IInlineCompletionContext
) {
): Promise<IInlineCompletionList<IInlineCompletionItem>> {
const mime = request.mimeType ?? 'text/plain';
const language = this.options.languageRegistry.findByMIME(mime);
if (!language) {
Expand Down Expand Up @@ -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<StreamChunk, void, unknown> {
let done = false;
while (!done) {
const delegate = new PromiseDelegate<StreamChunk>();
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai/src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const jupyternautStatus: JupyterFrontEndPlugin<IJupyternautStatus> = {
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 });
Expand Down

0 comments on commit 868e52b

Please sign in to comment.