🐛 fix(vscode): 写注释时改已有说明,不再在声明上面另插一行

This commit is contained in:
cruldra committed 2026-10-08 09:55:36 +08:00
1 parent 63dfb658e9
commit 7f39345d03
11 files changed
+196 -36

No files matched your search

+10 -1
View File
@@ -720,8 +720,17 @@ export interface LanguageAdapter {
toBlocks: (root: Node, source: string, languageId: string) => CodeBlock[]
/** 给语法树叶子节点定词性:源码着色用它,译文里照抄的词也按它着色、按它认出能查定义的名字。 */
tokenRole: (leaf: Node) => TokenRole
/** 行注释的记号(`#`、`//`):「重写注释」给还没有注释的块新写一段时用它;不填就不能新写。 */
/**
* 行注释的记号(`#`、`//`):块还没有说明、也没有前面的普通注释,而这门语言的说明就是行注释时(shell、Dockerfile),
* 「写注释」用它在块上面新写一段。不填、又没有 freshDoc,就不能新写。
*/
lineComment?: string
/**
* 还没有说明、也没有块前面的普通注释时,「写注释」新写的说明插在哪。
* shell 是带定界符的空壳,正文用 `_` 占位。breakAt 是主体和声明写在同一行:从这一行的这一列拆开,说明插进主体里。
* 不填就用 lineComment 写在块的第一行上面。
*/
freshDoc?: (block: CodeBlock) => { line: number, shell: string, breakAt?: number } | undefined
/** node 是写在表达式里的遍历(推导式、生成器表达式)时给出它的结构,别的节点没有;没有这种写法的语言不填。 */
iteration?: (node: Node) => IterationFacts | undefined
/** node 是一次调用(含新建对象)时给出它的结构,别的节点没有;没给的语言不展开调用,照常一行译文。 */