Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: parse json #4

Merged
merged 2 commits into from
Apr 21, 2024
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 @@ -2,7 +2,7 @@
"name": "ti18n",
"displayName": "Ti18n",
"description": "一个国际化字段提示插件,对国际化配置文件中提供的国际化字段进行特殊标注,鼠标移入时,可查看对应的国际化语言。",
"version": "0.1.0",
"version": "0.1.1",
"author": "https://github.com/showlotus",
"publisher": "showlotus",
"license": "MIT",
Expand Down
22 changes: 12 additions & 10 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@ export async function openDocumentRevealTokenRange(params: CommandTokenParams) {
*/
export async function getConfigJSON(folderPath: string) {
const configDirs = getConfiguration('configDirs')
console.log(configDirs)
const res = await Promise.all(
configDirs.map(async dir => {
return await fg.glob([`**/${dir}/*.json`], {
cwd: folderPath,
ignore: ['**/node_modules/**'],
absolute: true,
})
}),
if (!configDirs.length) {
return []
}

const res = await fg.glob(
configDirs.map(dir => `**/${dir}/*.json`),
{
cwd: folderPath,
ignore: ['**/node_modules/**'],
absolute: true,
},
)
return res.flat()
return res
}

/**
Expand Down