Skip to content

Commit

Permalink
Fix autocompletion for functions in chat input (#14838)
Browse files Browse the repository at this point in the history
* Fix autocompletion for functions in chat input

fixed #14837

Signed-off-by: Jonas Helming <[email protected]>
  • Loading branch information
JonasHelming authored Feb 6, 2025
1 parent 6c05489 commit 45f4953
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { inject, injectable, named } from '@theia/core/shared/inversify';
import { inject, injectable } from '@theia/core/shared/inversify';
import { FrontendApplication, FrontendApplicationContribution } from '@theia/core/lib/browser';
import * as monaco from '@theia/monaco-editor-core';
import { ContributionProvider, MaybePromise } from '@theia/core';
import { MaybePromise } from '@theia/core';
import { ProviderResult } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
import { ChatAgentService } from '@theia/ai-chat';
import { AIVariableService } from '@theia/ai-core/lib/common';
import { ToolProvider } from '@theia/ai-core/lib/common/tool-invocation-registry';
import { ToolInvocationRegistry } from '@theia/ai-core/lib/common/tool-invocation-registry';

export const CHAT_VIEW_LANGUAGE_ID = 'theia-ai-chat-view-language';
export const CHAT_VIEW_LANGUAGE_EXTENSION = 'aichatviewlanguage';
Expand All @@ -34,9 +34,8 @@ export class ChatViewLanguageContribution implements FrontendApplicationContribu
@inject(AIVariableService)
protected readonly variableService: AIVariableService;

@inject(ContributionProvider)
@named(ToolProvider)
private providers: ContributionProvider<ToolProvider>;
@inject(ToolInvocationRegistry)
protected readonly toolInvocationRegistry: ToolInvocationRegistry;

onStart(_app: FrontendApplication): MaybePromise<void> {
monaco.languages.register({ id: CHAT_VIEW_LANGUAGE_ID, extensions: [CHAT_VIEW_LANGUAGE_EXTENSION] });
Expand Down Expand Up @@ -130,7 +129,7 @@ export class ChatViewLanguageContribution implements FrontendApplicationContribu
model,
position,
'~',
this.providers.getContributions().map(provider => provider.getTool()),
this.toolInvocationRegistry.getAllFunctions(),
monaco.languages.CompletionItemKind.Function,
tool => tool.id,
tool => tool.name,
Expand Down

0 comments on commit 45f4953

Please sign in to comment.