Skip to content

Commit 5d7dc4e

Browse files
authored
Merge pull request #25 from lowcoding/feat/v1.8.1
✨ feat: 显示物料时追加项目名称,方便区分来自多个项目的物料
2 parents 0f7b336 + 09cc792 commit 5d7dc4e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-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 <[email protected]>",
6-
"version": "1.8.0",
6+
"version": "1.8.1",
77
"icon": "asset/icon.png",
88
"publisher": "wjkang",
99
"repository": "https://github.com/lowcoding/lowcode-vscode",

src/utils/materials.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ export const getLocalMaterials = (
4747
privateMaterials?: boolean;
4848
}[] = [];
4949
try {
50+
const splits = materialsFullPath.replace(/\\/g, '/').split('/');
51+
const projectName = splits[splits.length - 3];
5052
materials = fs.readdirSync(materialsFullPath).map((s) => {
5153
const fullPath = path.join(materialsFullPath, s);
5254
let model = {} as any;
5355
let schema = {} as any;
5456
let preview = {
57+
title: '',
5558
img: '',
5659
category: [],
5760
schema: 'form-render',
@@ -74,6 +77,9 @@ export const getLocalMaterials = (
7477
preview = JSON.parse(
7578
getFileContent(path.join(fullPath, 'config', 'preview.json'), true),
7679
);
80+
if (preview.title && getSyncFolder()) {
81+
preview.title = `[${projectName}] ${preview.title}`;
82+
}
7783
} catch {}
7884
try {
7985
commandPrompt = getFileContent(
@@ -133,7 +139,7 @@ export const getLocalMaterials = (
133139
}
134140
return {
135141
path: fullPath,
136-
name: s,
142+
name: `[${projectName}] ${s}`,
137143
model,
138144
schema,
139145
preview,
@@ -144,7 +150,7 @@ export const getLocalMaterials = (
144150
};
145151
});
146152
} catch {}
147-
return materials.filter((s) => s.name !== '.DS_Store');
153+
return materials.filter((s) => !s.name.includes('.DS_Store'));
148154
};
149155

150156
export const getCodeTemplateListFromFiles = () => {

0 commit comments

Comments
 (0)