Skip to content

Commit 0b1cf43

Browse files
authored
Merge pull request #8 from codefuse-ai/feat/0.6.0
release 0.6.0
2 parents 461d510 + 4eca74f commit 0b1cf43

File tree

7 files changed

+67
-8
lines changed

7 files changed

+67
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefuse-ide",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "CodeFuse AI Native IDE",
55
"main": "out/main",
66
"scripts": {

src/ai/browser/ai-native.contribution.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import {
66
IChatContent,
77
IChatProgress,
88
IAIBackService,
9+
CancellationToken,
10+
ChatResponse,
911
} from '@opensumi/ide-core-common';
1012
import { ClientAppContribution, Domain, getIcon } from '@opensumi/ide-core-browser';
1113
import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout';
12-
import { AINativeCoreContribution, ERunStrategy, IChatFeatureRegistry, IInlineChatFeatureRegistry, IRenameCandidatesProviderRegistry, ITerminalProviderRegistry, TChatSlashCommandSend, TerminalSuggestionReadableStream } from '@opensumi/ide-ai-native/lib/browser/types';
14+
import { AINativeCoreContribution, ERunStrategy, IChatFeatureRegistry, IInlineChatFeatureRegistry, IProblemFixContext, IProblemFixProviderRegistry, IRenameCandidatesProviderRegistry, ITerminalProviderRegistry, TChatSlashCommandSend, TerminalSuggestionReadableStream } from '@opensumi/ide-ai-native/lib/browser/types';
1315
import { ICodeEditor, MarkdownString, NewSymbolNameTag } from '@opensumi/ide-monaco';
1416
import { MessageService } from '@opensumi/ide-overlay/lib/browser/message.service';
1517
import { BaseTerminalDetectionLineMatcher, JavaMatcher, MatcherType, NodeMatcher, NPMMatcher, ShellMatcher, TSCMatcher } from '@opensumi/ide-ai-native/lib/browser/contrib/terminal/matcher';
@@ -518,4 +520,35 @@ export class AINativeContribution implements ComponentContribution, AINativeCore
518520
return stream;
519521
});
520522
}
523+
524+
525+
registerProblemFixFeature(registry: IProblemFixProviderRegistry): void {
526+
registry.registerHoverFixProvider({
527+
provideFix: async (
528+
editor: ICodeEditor,
529+
context: IProblemFixContext,
530+
token: CancellationToken,
531+
): Promise<ChatResponse | InlineChatController> => {
532+
const { marker, editRange } = context;
533+
534+
const prompt = `原始代码内容:
535+
\`\`\`
536+
${editor.getModel()!.getValueInRange(editRange)}
537+
\`\`\`
538+
539+
lint error 信息:
540+
541+
${marker.message}.
542+
543+
请根据 lint error 信息修复代码!
544+
不需要任何解释,只要返回修复后的代码块内容`;
545+
546+
const controller = new InlineChatController({ enableCodeblockRender: true });
547+
const stream = await this.aiBackService.requestStream(prompt, {}, token);
548+
controller.mountReadable(stream);
549+
550+
return controller;
551+
},
552+
});
553+
}
521554
}

src/bootstrap/browser/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ async function renderApp() {
170170
extensionStorageDirName: electronEnv.metadata.environment.dataFolderName,
171171
extWorkerHost: electronEnv.metadata.workerHostEntry ? URI.file(electronEnv.metadata.workerHostEntry).toString() : undefined,
172172
defaultPreferences: {
173-
[AINativeSettingSectionsId.InlineCompletionsPromptEngineeringEnabled]: false,
174173
'settings.userBeforeWorkspace': true,
175174
'general.icon': 'vs-seti',
175+
[AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled]: false,
176+
// 总是显示智能提示
177+
[AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible]: true,
176178
},
177179
onigWasmUri: URI.file(electronEnv.onigWasmPath).toString(true),
178180
treeSitterWasmDirectoryUri: URI.file(electronEnv.treeSitterWasmDirectoryPath).toString(true),
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
import { Autowired } from '@opensumi/di'
2-
import { Domain, MaybePromise } from '@opensumi/ide-core-common'
3-
import { ClientAppContribution, IClientApp } from '@opensumi/ide-core-browser'
2+
import { CommandContribution, CommandRegistry, Domain, MaybePromise } from '@opensumi/ide-core-common'
3+
import { ClientAppContribution, electronEnv } from '@opensumi/ide-core-browser'
44
import { IMenuRegistry, MenuId, MenuContribution } from "@opensumi/ide-core-browser/lib/menu/next";
55
import { localize } from "@opensumi/ide-core-common/lib/localize";
66
import { IWorkspaceService } from '@opensumi/ide-workspace';
77
import { IAppMenuService } from '../common';
8+
import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron';
89

9-
@Domain(ClientAppContribution, MenuContribution)
10+
const OPEN_LOGO_DIR_COMMAND_ID = {
11+
id: 'codefuse-ide.openLogDir',
12+
label: localize('codefuse-ide.openLogDir'),
13+
}
14+
15+
@Domain(ClientAppContribution, MenuContribution, CommandContribution)
1016
export class LocalMenuContribution implements MenuContribution, ClientAppContribution {
1117
@Autowired(IWorkspaceService)
1218
workspaceService: IWorkspaceService;
1319

1420
@Autowired(IAppMenuService)
1521
menuService: IAppMenuService;
1622

23+
@Autowired(IElectronMainUIService)
24+
private electronMainUIService: IElectronMainUIService;
25+
1726
initialize(): MaybePromise<void> {
1827
// this.renderAppMenu();
1928
}
@@ -23,11 +32,23 @@ export class LocalMenuContribution implements MenuContribution, ClientAppContrib
2332
await this.menuService.renderRecentWorkspaces(workspaces);
2433
}
2534

35+
registerCommands(registry: CommandRegistry) {
36+
registry.registerCommand(OPEN_LOGO_DIR_COMMAND_ID, {
37+
execute: () => {
38+
this.electronMainUIService.revealInFinder(electronEnv.metadata.environment.logRoot);
39+
},
40+
});
41+
}
42+
2643
registerMenus(menuRegistry: IMenuRegistry) {
2744
menuRegistry.registerMenuItem(MenuId.MenubarAppMenu, {
2845
submenu: MenuId.SettingsIconMenu,
2946
label: localize('common.preferences'),
3047
group: '2_preference',
3148
});
49+
50+
menuRegistry.registerMenuItem(MenuId.MenubarHelpMenu, {
51+
command: OPEN_LOGO_DIR_COMMAND_ID,
52+
});
3253
}
3354
}

src/core/electron-main/window/windows-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class WindowsManager {
6060
environment: {
6161
dataFolderName: this.environmentService.dataFolderName,
6262
isDev: this.environmentService.isDev,
63+
logRoot: this.environmentService.logRoot,
6364
},
6465
},
6566
{

src/i18n/en-US.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const localizationBundle = {
4444
'ai.model.noConfig': 'Please configure the AI model service for a better experience',
4545
'ai.model.go': 'Go',
4646

47-
'autoUpdater.checkForUpdates': 'Check for Updates...'
47+
'autoUpdater.checkForUpdates': 'Check for Updates...',
48+
'codefuse-ide.openLogDir': 'Open Log Folder',
4849
},
4950
};

src/i18n/zh-CN.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const localizationBundle = {
4444
'ai.model.noConfig': '为了更好的体验,请先配置 AI 模型服务',
4545
'ai.model.go': '前往',
4646

47-
'autoUpdater.checkForUpdates': '检查更新'
47+
'autoUpdater.checkForUpdates': '检查更新',
48+
'codefuse-ide.openLogDir': '打开日志文件夹',
4849
},
4950
};

0 commit comments

Comments
 (0)