Skip to content

Commit

Permalink
Merge pull request #25 from lowcoding/feat/v1.8.1
Browse files Browse the repository at this point in the history
✨ feat: 显示物料时追加项目名称,方便区分来自多个项目的物料
  • Loading branch information
wjkang authored Jun 16, 2024
2 parents 0f7b336 + 09cc792 commit 5d7dc4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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 and other LLM",
"author": "wjkang <ruoxieme@gmail.com>",
"version": "1.8.0",
"version": "1.8.1",
"icon": "asset/icon.png",
"publisher": "wjkang",
"repository": "https://github.com/lowcoding/lowcode-vscode",
Expand Down
10 changes: 8 additions & 2 deletions src/utils/materials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ export const getLocalMaterials = (
privateMaterials?: boolean;
}[] = [];
try {
const splits = materialsFullPath.replace(/\\/g, '/').split('/');
const projectName = splits[splits.length - 3];
materials = fs.readdirSync(materialsFullPath).map((s) => {
const fullPath = path.join(materialsFullPath, s);
let model = {} as any;
let schema = {} as any;
let preview = {
title: '',
img: '',
category: [],
schema: 'form-render',
Expand All @@ -74,6 +77,9 @@ export const getLocalMaterials = (
preview = JSON.parse(
getFileContent(path.join(fullPath, 'config', 'preview.json'), true),
);
if (preview.title && getSyncFolder()) {
preview.title = `[${projectName}] ${preview.title}`;
}
} catch {}
try {
commandPrompt = getFileContent(
Expand Down Expand Up @@ -133,7 +139,7 @@ export const getLocalMaterials = (
}
return {
path: fullPath,
name: s,
name: `[${projectName}] ${s}`,
model,
schema,
preview,
Expand All @@ -144,7 +150,7 @@ export const getLocalMaterials = (
};
});
} catch {}
return materials.filter((s) => s.name !== '.DS_Store');
return materials.filter((s) => !s.name.includes('.DS_Store'));
};

export const getCodeTemplateListFromFiles = () => {
Expand Down

0 comments on commit 5d7dc4e

Please sign in to comment.