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 @@ -3,7 +3,7 @@
"displayName": "lowcode",
"description": "lowcode tool, support ChatGPT",
"author": "wjkang <ruoxieme@gmail.com>",
"version": "1.7.6",
"version": "1.7.7",
"icon": "asset/icon.png",
"publisher": "wjkang",
"repository": "https://github.com/lowcoding/lowcode-vscode",
Expand Down
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/utils/editor.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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('无打开文件');
}
Expand All @@ -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('无打开文件');
}
Expand Down
6 changes: 4 additions & 2 deletions src/utils/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -94,6 +94,7 @@ export const genCodeByBlock = async (data: {
.replace(/\\/g, '/'),
createChatCompletion: createChatCompletionForScript,
materialPath: block,
activeTextEditor: getLastActiveTextEditor(),
};
data.model = {
...data.model,
Expand Down Expand Up @@ -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,
Expand All @@ -199,6 +200,7 @@ export const genCodeBySnippet = async (data: {
createChatCompletion: createChatCompletionForScript,
materialPath: snippetPath,
code: '',
activeTextEditor: getLastActiveTextEditor(),
};
const extendModel = await hook.beforeCompile(context);
if (extendModel) {
Expand Down
2 changes: 2 additions & 0 deletions src/webview/controllers/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion webview-react/src/components/AmisComponent/cxd.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions webview-react/src/components/AmisComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class RunScriptAction implements RendererAction {
materialPath: componentData.materialPath,
privateMaterials: componentData.privateMaterials,
createBlockPath: localStorage.getItem('selectedFolder') || undefined,
clipboardImage: '',
});
}
}
Expand Down