✨ feat(vscode): 代码阅读把推导式换成按读的顺序重排的遍历小框

This commit is contained in:
cruldra committed 2026-09-26 16:15:09 +08:00
1 parent 677fb7da1f
commit 6416cdf714
16 files changed
+641 -91

No files matched your search

@@ -1,5 +1,5 @@
import type { Node, Translator } from '../contract'
import { insideAnnotation, pythonTokenRole } from '../languages/python'
import { insideAnnotation, pythonIteration, pythonTokenRole } from '../languages/python'
import { createZhTemplateTranslator } from './zhTemplate'
function stringContent(node: Node): string {
@@ -39,7 +39,7 @@ export const pythonZhTranslator: Translator = createZhTemplateTranslator({
},
},
'for': '遍历',
'in': { zh: '在', byContext: { for_statement: '取自', for_in_clause: '取自' } },
'in': { zh: '在', byContext: { for_statement: '取自' } },
'while': '当',
'try': '尝试',
'except': '捕获',
@@ -87,4 +87,5 @@ export const pythonZhTranslator: Translator = createZhTemplateTranslator({
nodeTemplates: {
conditional_expression: ['如果', { namedChild: 1 }, '则', { namedChild: 0 }, '否则', { namedChild: 2 }],
},
iteration: pythonIteration,
})