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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0 ",
"@opensumi/ide-dev-tool": "workspace:*",
"@opensumi/tree-sitter-wasm": "^0.0.1",
"@opensumi/tree-sitter-wasm": "0.0.2",
"@types/debug": "^4.1.5",
"@types/fs-extra": "^11.0.4",
"@types/glob": "^7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dom-align": "^1.7.0",
"react-chat-elements": "^12.0.10",
"react-highlight": "^0.15.0",
"web-tree-sitter": "^0.22.2"
"web-tree-sitter": "0.22.6"
},
"devDependencies": {
"@opensumi/ide-core-browser": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-native/src/browser/languages/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class LanguageParserService {
const treeSitterLang = parserNameMap[language];
if (treeSitterLang) {
if (!this.pool.has(treeSitterLang)) {
this.pool.set(treeSitterLang, this.injector.get(LanguageParser, [language]));
this.pool.set(treeSitterLang, this.injector.get(LanguageParser, [treeSitterLang]));
}

return this.pool.get(treeSitterLang);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ export class AIInlineContentWidget extends ReactInlineContentWidget {

override getDomNode(): HTMLElement {
const domNode = super.getDomNode();
domNode.style.padding = '6px';
domNode.style.zIndex = StackingLevelStr.OverlayTop;

requestAnimationFrame(() => {
domNode.style.padding = '6px';
domNode.style.zIndex = StackingLevelStr.OverlayTop;
});
return domNode;
}

Expand Down Expand Up @@ -104,7 +105,8 @@ export class AIInlineContentWidget extends ReactInlineContentWidget {

public offsetTop(top: number): void {
if (this.originTop === 0) {
this.originTop = this.domNode.style.top ? parseInt(this.domNode.style.top, 10) : 0;
const top = this.domNode.style.top;
this.originTop = top ? parseInt(top, 10) : 0;
}

this.domNode.style.top = `${this.originTop + top}px`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class InlineDiffWidget extends ZoneWidget {
protected applyStyle(): void {}

protected _fillContainer(container: HTMLElement): void {
this.setCssClass('ai_diff-widget');
this.setCssClass('inline-diff-widget');
this.root = ReactDOMClient.createRoot(container);

this.root.render(
Expand Down Expand Up @@ -198,6 +198,12 @@ export class InlineDiffWidget extends ZoneWidget {
}

public showByLine(line: number, lineNumber = 20): void {
/**
* 暂时通过 hack 的方式使其能让 zonewidget 在空白处显示出来
*/
// @ts-ignore
this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible = () => true;

super.show(
{
startLineNumber: line,
Expand Down
2 changes: 1 addition & 1 deletion packages/core-browser/src/application/runtime/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export enum ESupportRuntime {
}

export const onigWasmCDNUri = 'https://g.alicdn.com/kaitian/vscode-oniguruma-wasm/1.5.1/onig.wasm';
export const treeSitterWasmCDNUri = 'https://gw.alipayobjects.com/os/lib/opensumi/tree-sitter-wasm/0.0.1/';
export const treeSitterWasmCDNUri = 'https://gw.alipayobjects.com/os/lib/opensumi/tree-sitter-wasm/0.0.2';
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export interface ShowAIContentOptions {
@Injectable({ multiple: true })
export abstract class ReactInlineContentWidget extends Disposable implements IInlineContentWidget {
@Autowired(AppConfig)
private configContext: AppConfig;
private appConfig: AppConfig;

allowEditorOverflow?: boolean | undefined = false;
suppressMouseDown?: boolean | undefined = true;
allowEditorOverflow = false;
suppressMouseDown = true;

protected domNode: HTMLElement;
protected options: ShowAIContentOptions | undefined;
Expand All @@ -39,7 +39,7 @@ export abstract class ReactInlineContentWidget extends Disposable implements IIn
this.addDispose(
runWhenIdle(() => {
this.root = ReactDOMClient.createRoot(this.getDomNode());
this.root.render(<ConfigProvider value={this.configContext}>{this.renderView()}</ConfigProvider>);
this.root.render(<ConfigProvider value={this.appConfig}>{this.renderView()}</ConfigProvider>);
this.layoutContentWidget();
}),
);
Expand Down Expand Up @@ -89,8 +89,10 @@ export abstract class ReactInlineContentWidget extends Disposable implements IIn
getDomNode(): HTMLElement {
if (!this.domNode) {
this.domNode = document.createElement('div');
this.domNode.classList.add(this.getId());
this.domNode.style.zIndex = StackingLevelStr.Overlay;
requestAnimationFrame(() => {
this.domNode.classList.add(this.getId());
this.domNode.style.zIndex = StackingLevelStr.Overlay;
});
}

const throttled = throttle(() => {
Expand Down
22 changes: 12 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ __metadata:
"@commitlint/cli": "npm:^19.2.1"
"@commitlint/config-conventional": "npm:^19.1.0 "
"@opensumi/ide-dev-tool": "workspace:*"
"@opensumi/tree-sitter-wasm": "npm:^0.0.1"
"@opensumi/tree-sitter-wasm": "npm:0.0.2"
"@types/debug": "npm:^4.1.5"
"@types/fs-extra": "npm:^11.0.4"
"@types/glob": "npm:^7.1.1"
Expand Down Expand Up @@ -2082,7 +2082,7 @@ __metadata:
dom-align: "npm:^1.7.0"
react-chat-elements: "npm:^12.0.10"
react-highlight: "npm:^0.15.0"
web-tree-sitter: "npm:^0.22.2"
web-tree-sitter: "npm:0.22.6"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -3143,10 +3143,12 @@ __metadata:
languageName: node
linkType: hard

"@opensumi/tree-sitter-wasm@npm:^0.0.1":
version: 0.0.1
resolution: "@opensumi/tree-sitter-wasm@npm:0.0.1"
checksum: 10/5385a7966e2220d3e2fb13a7cc1fb58f26d13b9bc878084481a1b17392cb902b3da5ddfbfa77376da4bdc2de8a644dd0292972bc15b2cb4a7bcb2b6157e0b2b9
"@opensumi/tree-sitter-wasm@npm:0.0.2":
version: 0.0.2
resolution: "@opensumi/tree-sitter-wasm@npm:0.0.2"
dependencies:
web-tree-sitter: "npm:0.22.6"
checksum: 10/38e61a05b0696ed69144ece0d48f1ef9a0c9e19c20aaf6270e687a8ad78fda8342836cdf3bb29b722be73b9749f7f003f5bf6933008a70cbed99861797ab530d
languageName: node
linkType: hard

Expand Down Expand Up @@ -19825,10 +19827,10 @@ __metadata:
languageName: node
linkType: hard

"web-tree-sitter@npm:^0.22.2":
version: 0.22.2
resolution: "web-tree-sitter@npm:0.22.2"
checksum: 10/f9c83a5ddab3ecd0ac33c8ccc00aec1184c9513255c00fdaf2d35f8fff49a9fcdd0b0545f4b86ea3e020d2bdcfde2e4a792642794d3a353530f3a55c15385464
"web-tree-sitter@npm:0.22.6":
version: 0.22.6
resolution: "web-tree-sitter@npm:0.22.6"
checksum: 10/0b4378feff9d49466a2d63bccf3fcf2fd12184f80c009739e68a1201ae778196bc68bcc18641906659d42ce1a01fd8383637b3dd5c5c2c069288559fe7721d5e
languageName: node
linkType: hard

Expand Down