File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 },
1212 "dependencies" : {
1313 "@babel/runtime" : " ^7.28.2" ,
14+ "@codemirror/lang-cpp" : " ^6.0.3" ,
1415 "@codemirror/lang-go" : " ^6.0.1" ,
1516 "@codemirror/lang-java" : " ^6.0.2" ,
1617 "@codemirror/lang-javascript" : " ^6.2.4" ,
Original file line number Diff line number Diff line change 1515 <!-- 代码编辑器 -->
1616 <div class =" flex-1 flex flex-col overflow-hidden" >
1717 <div class =" bg-gray-100 px-4 py-2 border-b border-gray-200 flex items-center justify-between flex-shrink-0" >
18- <h2 class =" text-sm font-medium text-gray-700" >{{ getLanguageDisplayName(currentLanguage) }} 代码编辑器</h2 >
18+ <div class =" flex items-center space-x-3" >
19+ <img :src =" `/icons/${currentLanguage.replace(/\d+$/, '')}.svg`" class =" w-5 h-5" :alt =" currentLanguage" />
20+ <h2 class =" text-sm font-medium text-gray-700" >{{ getLanguageDisplayName(currentLanguage) }} 代码编辑器</h2 >
21+ </div >
22+
1923 <div class =" flex items-center space-x-2 text-xs text-gray-500" >
2024 <span ><strong >{{ (code || '').length }}</strong > 字符</span >
2125 <span ><strong >{{ (code || '').split('\n').length }}</strong > 行</span >
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { javascript } from '@codemirror/lang-javascript'
44import { go } from '@codemirror/lang-go'
55import { java } from '@codemirror/lang-java'
66import { rust } from '@codemirror/lang-rust'
7+ import { cpp } from '@codemirror/lang-cpp'
78import { shell } from '@codemirror/legacy-modes/mode/shell'
89import { swift } from '@codemirror/legacy-modes/mode/swift'
910import { kotlin , scala } from '@codemirror/legacy-modes/mode/clike'
@@ -161,6 +162,8 @@ export function useCodeMirrorEditor(props: Props)
161162 return java ( )
162163 case 'rust' :
163164 return rust ( )
165+ case 'c' :
166+ return cpp ( )
164167 case 'shell' :
165168 return StreamLanguage . define ( shell )
166169 case 'swift' :
You can’t perform that action at this time.
0 commit comments