diff --git a/package.json b/package.json index b87b1cf..c80b1b1 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "lowcode", "description": "lowcode tool, support ChatGPT", "author": "wjkang ", - "version": "1.7.6", + "version": "1.7.7", "icon": "asset/icon.png", "publisher": "wjkang", "repository": "https://github.com/lowcoding/lowcode-vscode", diff --git a/src/context.ts b/src/context.ts index c1fd5e9..1410c0b 100644 --- a/src/context.ts +++ b/src/context.ts @@ -27,7 +27,7 @@ export const setLastActiveTextEditorId = (activeTextEditorId: string) => { data.activeTextEditorId = activeTextEditorId; }; -export const getLastAcitveTextEditor = () => { +export const getLastActiveTextEditor = () => { const { visibleTextEditors } = window; const activeTextEditor = visibleTextEditors.find( (item: any) => item.id === data.activeTextEditorId, diff --git a/src/utils/editor.ts b/src/utils/editor.ts index 62f959e..acf5cb5 100644 --- a/src/utils/editor.ts +++ b/src/utils/editor.ts @@ -1,6 +1,6 @@ import * as copyPaste from 'copy-paste'; import { OpenDialogOptions, Range, SnippetString, window } from 'vscode'; -import { getLastAcitveTextEditor } from '../context'; +import { getLastActiveTextEditor } from '../context'; export const getClipboardText = () => copyPaste.paste(); @@ -14,7 +14,7 @@ export const pasteToEditor = (content: string, isInsertSnippet = true) => { if (isInsertSnippet) { return insertSnippet(content); } - const activeTextEditor = getLastAcitveTextEditor(); + const activeTextEditor = getLastActiveTextEditor(); if (activeTextEditor === undefined) { throw new Error('无打开文件'); } @@ -35,7 +35,7 @@ export const pasteToEditor = (content: string, isInsertSnippet = true) => { }; export const insertSnippet = (content: string) => { - const activeTextEditor = window.activeTextEditor || getLastAcitveTextEditor(); + const activeTextEditor = window.activeTextEditor || getLastActiveTextEditor(); if (activeTextEditor === undefined) { throw new Error('无打开文件'); } diff --git a/src/utils/generate.ts b/src/utils/generate.ts index ccd652e..9a7a16a 100644 --- a/src/utils/generate.ts +++ b/src/utils/generate.ts @@ -16,7 +16,7 @@ import { pasteToEditor } from './editor'; import { getFileContent } from './file'; import { getInnerLibs } from './lib'; import { getOutputChannel } from './outputChannel'; -import { getLastAcitveTextEditor } from '../context'; +import { getLastActiveTextEditor } from '../context'; import { getSyncFolder } from './config'; import { createChatCompletionForScript } from './openai'; @@ -94,6 +94,7 @@ export const genCodeByBlock = async (data: { .replace(/\\/g, '/'), createChatCompletion: createChatCompletionForScript, materialPath: block, + activeTextEditor: getLastActiveTextEditor(), }; data.model = { ...data.model, @@ -178,7 +179,7 @@ export const genCodeBySnippet = async (data: { hook.afterCompile = script.afterCompile; } } - const activeTextEditor = getLastAcitveTextEditor(); + const activeTextEditor = getLastActiveTextEditor(); if (activeTextEditor) { data.model = { ...data.model, @@ -199,6 +200,7 @@ export const genCodeBySnippet = async (data: { createChatCompletion: createChatCompletionForScript, materialPath: snippetPath, code: '', + activeTextEditor: getLastActiveTextEditor(), }; const extendModel = await hook.beforeCompile(context); if (extendModel) { diff --git a/src/webview/controllers/script.ts b/src/webview/controllers/script.ts index 43a37cb..efa671f 100644 --- a/src/webview/controllers/script.ts +++ b/src/webview/controllers/script.ts @@ -7,6 +7,7 @@ import { getEnv, rootPath } from '../../utils/vscodeEnv'; import { getInnerLibs } from '../../utils/lib'; import { getOutputChannel } from '../../utils/outputChannel'; import { createChatCompletionForScript } from '../../utils/openai'; +import { getLastActiveTextEditor } from '../../context'; export const runScript = async ( message: IMessage<{ @@ -36,6 +37,7 @@ export const runScript = async ( createBlockPath: message.data.createBlockPath, createChatCompletion: createChatCompletionForScript, materialPath: message.data.materialPath, + activeTextEditor: getLastActiveTextEditor(), }; const extendModel = await script[message.data.script](context); return extendModel; diff --git a/webview-react/src/components/AmisComponent/cxd.css b/webview-react/src/components/AmisComponent/cxd.css index be26c5c..5d60150 100644 --- a/webview-react/src/components/AmisComponent/cxd.css +++ b/webview-react/src/components/AmisComponent/cxd.css @@ -22234,7 +22234,7 @@ input[type='button'].cxd-Button--block { .cxd-ButtonGroup > .cxd-Button { position: relative; flex: 0 1 auto; - max-width: 8.75rem; + max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/webview-react/src/components/AmisComponent/index.tsx b/webview-react/src/components/AmisComponent/index.tsx index 2b4c511..4c1f0f6 100644 --- a/webview-react/src/components/AmisComponent/index.tsx +++ b/webview-react/src/components/AmisComponent/index.tsx @@ -65,6 +65,7 @@ export class RunScriptAction implements RendererAction { materialPath: componentData.materialPath, privateMaterials: componentData.privateMaterials, createBlockPath: localStorage.getItem('selectedFolder') || undefined, + clipboardImage: '', }); } }