Skip to content

Commit e119e74

Browse files
authored
Merge pull request #18 from lowcoding/feat/v1.7.7
Feat/v1.7.7
2 parents b09af77 + 45fe6a4 commit e119e74

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "lowcode",
44
"description": "lowcode tool, support ChatGPT",
55
"author": "wjkang <[email protected]>",
6-
"version": "1.7.6",
6+
"version": "1.7.7",
77
"icon": "asset/icon.png",
88
"publisher": "wjkang",
99
"repository": "https://github.com/lowcoding/lowcode-vscode",

src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const setLastActiveTextEditorId = (activeTextEditorId: string) => {
2727
data.activeTextEditorId = activeTextEditorId;
2828
};
2929

30-
export const getLastAcitveTextEditor = () => {
30+
export const getLastActiveTextEditor = () => {
3131
const { visibleTextEditors } = window;
3232
const activeTextEditor = visibleTextEditors.find(
3333
(item: any) => item.id === data.activeTextEditorId,

src/utils/editor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as copyPaste from 'copy-paste';
22
import { OpenDialogOptions, Range, SnippetString, window } from 'vscode';
3-
import { getLastAcitveTextEditor } from '../context';
3+
import { getLastActiveTextEditor } from '../context';
44

55
export const getClipboardText = () => copyPaste.paste();
66

@@ -14,7 +14,7 @@ export const pasteToEditor = (content: string, isInsertSnippet = true) => {
1414
if (isInsertSnippet) {
1515
return insertSnippet(content);
1616
}
17-
const activeTextEditor = getLastAcitveTextEditor();
17+
const activeTextEditor = getLastActiveTextEditor();
1818
if (activeTextEditor === undefined) {
1919
throw new Error('无打开文件');
2020
}
@@ -35,7 +35,7 @@ export const pasteToEditor = (content: string, isInsertSnippet = true) => {
3535
};
3636

3737
export const insertSnippet = (content: string) => {
38-
const activeTextEditor = window.activeTextEditor || getLastAcitveTextEditor();
38+
const activeTextEditor = window.activeTextEditor || getLastActiveTextEditor();
3939
if (activeTextEditor === undefined) {
4040
throw new Error('无打开文件');
4141
}

src/utils/generate.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { pasteToEditor } from './editor';
1616
import { getFileContent } from './file';
1717
import { getInnerLibs } from './lib';
1818
import { getOutputChannel } from './outputChannel';
19-
import { getLastAcitveTextEditor } from '../context';
19+
import { getLastActiveTextEditor } from '../context';
2020
import { getSyncFolder } from './config';
2121
import { createChatCompletionForScript } from './openai';
2222

@@ -94,6 +94,7 @@ export const genCodeByBlock = async (data: {
9494
.replace(/\\/g, '/'),
9595
createChatCompletion: createChatCompletionForScript,
9696
materialPath: block,
97+
activeTextEditor: getLastActiveTextEditor(),
9798
};
9899
data.model = {
99100
...data.model,
@@ -178,7 +179,7 @@ export const genCodeBySnippet = async (data: {
178179
hook.afterCompile = script.afterCompile;
179180
}
180181
}
181-
const activeTextEditor = getLastAcitveTextEditor();
182+
const activeTextEditor = getLastActiveTextEditor();
182183
if (activeTextEditor) {
183184
data.model = {
184185
...data.model,
@@ -199,6 +200,7 @@ export const genCodeBySnippet = async (data: {
199200
createChatCompletion: createChatCompletionForScript,
200201
materialPath: snippetPath,
201202
code: '',
203+
activeTextEditor: getLastActiveTextEditor(),
202204
};
203205
const extendModel = await hook.beforeCompile(context);
204206
if (extendModel) {

src/webview/controllers/script.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getEnv, rootPath } from '../../utils/vscodeEnv';
77
import { getInnerLibs } from '../../utils/lib';
88
import { getOutputChannel } from '../../utils/outputChannel';
99
import { createChatCompletionForScript } from '../../utils/openai';
10+
import { getLastActiveTextEditor } from '../../context';
1011

1112
export const runScript = async (
1213
message: IMessage<{
@@ -36,6 +37,7 @@ export const runScript = async (
3637
createBlockPath: message.data.createBlockPath,
3738
createChatCompletion: createChatCompletionForScript,
3839
materialPath: message.data.materialPath,
40+
activeTextEditor: getLastActiveTextEditor(),
3941
};
4042
const extendModel = await script[message.data.script](context);
4143
return extendModel;

webview-react/src/components/AmisComponent/cxd.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22234,7 +22234,7 @@ input[type='button'].cxd-Button--block {
2223422234
.cxd-ButtonGroup > .cxd-Button {
2223522235
position: relative;
2223622236
flex: 0 1 auto;
22237-
max-width: 8.75rem;
22237+
max-width: none;
2223822238
overflow: hidden;
2223922239
text-overflow: ellipsis;
2224022240
white-space: nowrap;

webview-react/src/components/AmisComponent/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class RunScriptAction implements RendererAction {
6565
materialPath: componentData.materialPath,
6666
privateMaterials: componentData.privateMaterials,
6767
createBlockPath: localStorage.getItem('selectedFolder') || undefined,
68+
clipboardImage: '',
6869
});
6970
}
7071
}

0 commit comments

Comments
 (0)