✨ feat(vscode): 代码阅读的 FastAPI 接口多一个筛选属性「请求方法」(GET / POST …);库规则自己报的筛选属性由规则起名(LibraryRule.attributeNames)
This commit is contained in:
1 parent
ec34ace7cf
commit
b4e4879570
9 files changed
+107
-11
No files matched your search
@@ -80,3 +80,16 @@ export function fileAttributes(blocks: readonly Attributed[], names: AttributeNa
|
||||
values: [...values].map(([value, count]) => ({ id: value, name: valueName(id, value), count })),
|
||||
}))
|
||||
}
|
||||
|
||||
/** 几份属性和值的叫法合成一份:同一个属性、同一个值谁排在前面、给了名字就用谁的(翻译插件的排在库规则的前面)。 */
|
||||
export function mergeAttributeNames(list: readonly (AttributeNames | undefined)[]): AttributeNames {
|
||||
const merged: AttributeNames = { attributes: {}, values: {} }
|
||||
for (const names of [...list].reverse()) {
|
||||
if (!names)
|
||||
continue
|
||||
Object.assign(merged.attributes, names.attributes)
|
||||
for (const [id, values] of Object.entries(names.values))
|
||||
merged.values[id] = { ...merged.values[id], ...values }
|
||||
}
|
||||
return merged
|
||||
}
|
||||
Reference in new issue
Block a user