✨ feat(vscode): 代码阅读把说明里的 @param / @return / @throws 拆到参数表、输出、异常表

This commit is contained in:
cruldra committed 2026-10-08 07:17:26 +08:00
1 parent c2982537d7
commit 0958506681
43 files changed
+1300 -323

No files matched your search

+4 -4
View File
@@ -1,4 +1,4 @@
import type { ImplBlock, KindBadge, LibraryRule, RuleCard, ThemeColor } from '../contract'
import type { ImplBlock, KindBadge, LibraryRule, RuleCard, RuleContext, ThemeColor } from '../contract'
import { implRows, plainSay } from './rustRows'
/** 和函数卡同一个黄,实现块看起来仍是函数那一挂。 */
@@ -14,15 +14,15 @@ export const rustImplRule: LibraryRule = {
label: 'Rust 实现',
languageIds: ['rust'],
libraries: [],
claim: block => block.kind === 'impl' ? implCard(block) : undefined,
claim: (block, context) => block.kind === 'impl' ? implCard(block, context) : undefined,
attributeNames: () => ({
attributes: {},
values: { kind: { 'rust.impl': '实现' } },
}),
}
function implCard(block: ImplBlock): RuleCard {
const rows = implRows(block, plainSay())
function implCard(block: ImplBlock, context: RuleContext): RuleCard {
const rows = implRows(block, plainSay(context.doc))
const row = rows.findIndex(item => item.label === '方法')
const methods = block.children.filter(child => child.kind === 'function')
return {