Skip to content

Commit 9c9a479

Browse files
authored
Merge pull request #26 from lowcoding/feat/v1.8.2
🐞 fix: resetMaterialName
2 parents 5d7dc4e + 84e3484 commit 9c9a479

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
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 and other LLM",
55
"author": "wjkang <ruoxieme@gmail.com>",
6-
"version": "1.8.1",
6+
"version": "1.8.2",
77
"icon": "asset/icon.png",
88
"publisher": "wjkang",
99
"repository": "https://github.com/lowcoding/lowcode-vscode",

src/utils/generate.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getOutputChannel } from './outputChannel';
1919
import { getLastActiveTextEditor } from '../context';
2020
import { getSyncFolder } from './config';
2121
import { createChatCompletionForScript } from './llm';
22+
import { resetMaterialName } from './name';
2223

2324
export const genCodeByBlock = async (data: {
2425
material: string;
@@ -36,7 +37,7 @@ export const genCodeByBlock = async (data: {
3637
data.privateMaterials
3738
? getPrivateBlockMaterialsPath()
3839
: blockMaterialsPath,
39-
data.material,
40+
resetMaterialName(data.material),
4041
);
4142
const schemaFile = path.join(block, 'config/schema.json');
4243
const schama = fs.readJSONSync(schemaFile);
@@ -161,7 +162,7 @@ export const genCodeBySnippet = async (data: {
161162
data.privateMaterials
162163
? getPrivateSnippetMaterialsPath()
163164
: snippetMaterialsPath,
164-
data.name,
165+
resetMaterialName(data.name),
165166
);
166167
const scriptFile = path.join(snippetPath, 'script/index.js');
167168
const hook = {

src/utils/name.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const resetMaterialName = (name: string) => {
2+
const arrayStr = name.split('] ');
3+
return arrayStr[1] || name;
4+
};

0 commit comments

Comments
 (0)