Skip to content

Commit d1a3c3c

Browse files
committed
feat (core): 美化编辑器状态栏
1 parent 3a45ead commit d1a3c3c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
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",

src/App.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
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>

src/composables/useCodeMirrorEditor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { javascript } from '@codemirror/lang-javascript'
44
import { go } from '@codemirror/lang-go'
55
import { java } from '@codemirror/lang-java'
66
import { rust } from '@codemirror/lang-rust'
7+
import { cpp } from '@codemirror/lang-cpp'
78
import { shell } from '@codemirror/legacy-modes/mode/shell'
89
import { swift } from '@codemirror/legacy-modes/mode/swift'
910
import { 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':

0 commit comments

Comments
 (0)