Skip to content

Commit 7972b0c

Browse files
author
guqiankun.gqk
committed
chore: update
1 parent 03dea52 commit 7972b0c

5 files changed

Lines changed: 97 additions & 68 deletions

File tree

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@
255255
"publisher": "aistudio",
256256
"name": "libro",
257257
"version": "0.0.3"
258+
},
259+
{
260+
"publisher": "alex",
261+
"name": "odc-theme",
262+
"version": "1.0.0"
258263
}
259264
]
260265
}

packages/integrations/src/sql/index.tsx

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useRef, useState } from 'react';
22
import ReactDOM from 'react-dom';
33
import { IAppInstance, AppRenderer, SlotLocation } from '@alipay/alex';
44
import '@alipay/alex/languages/sql';
@@ -13,6 +13,8 @@ import * as SQLPlugin from './sql.plugin';
1313
import { IEditor } from '@opensumi/ide-editor';
1414
import { Popover, Radio } from 'antd';
1515
import 'antd/dist/antd.css';
16+
import odcTheme from '@alipay/alex/extensions/alex.odc-theme';
17+
1618
setMonacoEnvironment();
1719

1820
const layoutConfig = {
@@ -48,22 +50,39 @@ async function editor() {
4850
console.log(editor?.monacoEditor.getValue());
4951
}
5052

53+
54+
5155
const App = () => {
5256
const [fontValue, setFontValue] = useState(16);
5357
const [encoding, setEncoding] = useState('utf8');
5458

59+
let tableID = 1
60+
61+
const suggestTables = useRef([{
62+
label: `sample_one_table_${tableID}`,
63+
type: 'SAMPLE_TYPE_ONE',
64+
insertText: 'LD.sample_one_table1',
65+
kind: CompletionItemKind.Method,
66+
sortText: 'a',
67+
}])
68+
69+
function changeTables() {
70+
tableID++;
71+
suggestTables.current = suggestTables.current.concat([{
72+
label: `sample_one_table_${tableID}`,
73+
type: 'SAMPLE_TYPE_ONE',
74+
insertText: 'LD.sample_one_table1',
75+
kind: CompletionItemKind.Method,
76+
sortText: 'a',
77+
}])
78+
}
5579
const onChangeFont = (e) => {
5680
setFontValue(e.target.value);
57-
console.log(e.target.value)
5881
updatePrefeence('editor.fontSize', e.target.value);
59-
console.log(SQLPlugin.api.commands?.executeCommand('alex.getDefaultPreference', 'files.encoding'))
6082
};
6183
const onChangeEnoding = (e) => {
6284
setEncoding(e.target.value);
63-
console.log(e.target.value)
64-
6585
updatePrefeence('files.encoding', e.target.value);
66-
6786
};
6887

6988
const content = () => (
@@ -90,6 +109,7 @@ const App = () => {
90109
<Button onClick={() => addLine()}>添加行</Button>
91110
<Button onClick={() => openFile()}>打开文件</Button>
92111
<Button onClick={() => editor()}>获取当前内容</Button>
112+
<Button onClick={() => changeTables()}>change suggest Tables</Button>
93113
<Popover content={content} placement="top">
94114
<Button>设置</Button>
95115
</Popover>
@@ -139,16 +159,8 @@ const App = () => {
139159
},
140160
],
141161
onSuggestTables: (keyword, options) => {
142-
console.log(keyword, options);
143-
return Promise.resolve([
144-
{
145-
label: 'sample_one_table1',
146-
type: 'SAMPLE_TYPE_ONE',
147-
insertText: 'LD.sample_one_table1',
148-
kind: CompletionItemKind.Method,
149-
sortText: 'a',
150-
},
151-
]);
162+
console.log('suggest',keyword, options,suggestTables.current);
163+
return suggestTables.current;
152164
},
153165
onSuggestFields: (prefix, options) => {
154166
return Promise.resolve([
@@ -177,6 +189,7 @@ const App = () => {
177189
},
178190
options: {
179191
language: supportLanguage.ODPSSQL,
192+
disableAsyncItemCache: true,
180193
},
181194
sorter: (type) => {
182195
switch (type) {
@@ -234,11 +247,11 @@ const App = () => {
234247
},
235248
}),
236249
],
237-
extensionMetadata: [],
250+
extensionMetadata: [odcTheme],
238251
workspaceDir: `sql-service`,
239252
layoutConfig,
240253
defaultPreferences: {
241-
'general.theme': 'opensumi-light',
254+
'general.theme': 'odc-light',
242255
'application.confirmExit': 'never',
243256
'editor.autoSave': 'afterDelay',
244257
'editor.guides.bracketPairs': false,

packages/sql-service/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function generateCorsUrl(url) {
3535
export function setMonacoEnvironment(uri?: string) {
3636
self['MonacoEnvironment'] = {
3737
getWorkerUrl: function () {
38-
return generateCorsUrl('http://127.0.0.1:8080/dist/odps-worker.22f636bf.js');
38+
return generateCorsUrl('http://127.0.0.1:8080/dist/odps-worker.c12053ed.js');
3939
},
4040
};
4141
}

0 commit comments

Comments
 (0)