Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 39 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"activationEvents": [
"onStartupFinished",
"onLanguageModelChat:copilot",
"onLanguageModelAccess:feima",
"onUri",
"onFileSystem:ccreq",
"onFileSystem:ccsettings",
Expand Down Expand Up @@ -139,6 +140,12 @@
"contribEditorContentMenu"
],
"contributes": {
"authentication": [
{
"id": "feima-authentication",
"label": "Feima Auth"
}
],
"languageModelTools": [
{
"name": "copilot_searchCodebase",
Expand Down Expand Up @@ -1680,6 +1687,10 @@
}
],
"languageModelChatProviders": [
{
"vendor": "feima",
"displayName": "Feima Models"
},
{
"vendor": "copilot",
"displayName": "Copilot"
Expand Down Expand Up @@ -2316,10 +2327,30 @@
"category": "GitHub Copilot"
},
{
"command": "github.copilot.chat.applyCopilotCLIAgentSessionChanges.apply",
"command": "github.copilot.chat.applyCopilotCLIAgentSessionChanges.apply",
"title": "%github.copilot.chat.applyCopilotCLIAgentSessionChanges.apply%",
"icon": "$(git-stash-pop)",
"category": "GitHub Copilot"
},
{
"command": "feima.signIn",
"title": "Sign in with Feima",
"category": "Feima"
},
{
"command": "feima.signOut",
"title": "Sign Out",
"category": "Feima"
},
{
"command": "feima.listModels",
"title": "List Available Models",
"category": "Feima"
},
{
"command": "feima.checkContextKey",
"title": "Check Authentication Status",
"category": "Feima"
}
],
"configuration": [
Expand Down Expand Up @@ -3917,6 +3948,13 @@
}
],
"menus": {
"AccountsContext": [
{
"command": "feima.signIn",
"group": "1_accounts",
"when": "!github.copilot.feimaAuth.signedIn"
}
],
"editor/title": [
{
"command": "github.copilot.debug.generateInlineEditTests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import { autorun, observableFromEvent } from '../../../util/vs/base/common/obser
import { registerUnificationCommands } from '../../completions-core/vscode-node/completionsServiceBridges';
import { ICopilotInlineCompletionItemProviderService } from '../common/copilotInlineCompletionItemProviderService';
import { unificationStateObservable } from './completionsUnificationContribution';
import { Qwen3CompletionProvider } from './qwen3CompletionProvider';

export class CompletionsCoreContribution extends Disposable {

private _provider: CopilotInlineCompletionItemProvider | undefined;
private _qwen3Provider: Qwen3CompletionProvider | undefined;

private readonly _copilotToken = observableFromEvent(this, this.authenticationService.onDidAuthenticationChange, () => this.authenticationService.copilotToken);

constructor(
Expand All @@ -31,9 +35,26 @@ export class CompletionsCoreContribution extends Disposable {
const unificationStateValue = unificationState.read(reader);
const configEnabled = configurationService.getExperimentBasedConfigObservable<boolean>(ConfigKey.TeamInternal.InlineEditsEnableGhCompletionsProvider, experimentationService).read(reader);
const extensionUnification = unificationStateValue?.extensionUnification ?? false;
let hasInstantiatedProvider = false;
// Check if Qwen3 is configured
const qwen3ApiKey = process.env.QWEN3_API_KEY;
const qwen3BaseUrl = process.env.QWEN3_BASE_URL || 'https://dashscope.aliyuncs.com/compatible-mode/v1';

let hasInstantiatedProvider = false;
if (unificationStateValue?.codeUnification || extensionUnification || configEnabled || this._copilotToken.read(reader)?.isNoAuthUser) {
if (qwen3ApiKey) {
// Use Qwen3 provider if configured
const qwen3Provider = this._getOrCreateQwen3Provider(qwen3ApiKey, qwen3BaseUrl);
reader.store.add(
languages.registerInlineCompletionItemProvider(
{ pattern: '**' },
qwen3Provider,
{
debounceDelayMs: 0,
excludes: ['qwen3-completions'],
groupId: 'completions'
}
)
);
} else if (unificationStateValue?.codeUnification || extensionUnification || configEnabled || this._copilotToken.read(reader)?.isNoAuthUser) {
const provider = _copilotInlineCompletionItemProviderService.getOrCreateProvider();
reader.store.add(
languages.registerInlineCompletionItemProvider(
Expand Down Expand Up @@ -62,4 +83,11 @@ export class CompletionsCoreContribution extends Disposable {
void commands.executeCommand('setContext', 'github.copilot.activated', token !== undefined);
}));
}

private _getOrCreateQwen3Provider(apiKey: string, baseUrl: string) {
if (!this._qwen3Provider) {
this._qwen3Provider = this._register(this._instantiationService.createInstance(Qwen3CompletionProvider, apiKey, baseUrl));
}
return this._qwen3Provider;
}
}
Loading
Loading