Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: add c/cpp/auto options in code langauges

Mayur Mahajan70963a55f17c
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
index 1490f583cb..5048ffc0c8 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
@@ -123,7 +123,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
'BASIC',
'C',
'C#',
- 'C++',
+ 'CPP',
'Clojure',
'CSS',
'Dart',
@@ -167,7 +167,10 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
.map((e) => e.toLowerCase())
.toSet()
.intersection(allLanguages.keys.toSet())
- .toList();
+ .toList()
+ ..add('auto')
+ ..add('c')
+ ..sort();
late final editorState = context.read<EditorState>();
@@ -253,7 +256,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 4),
child: FlowyTextButton(
- '${language?.capitalize() ?? 'auto'} ',
+ '${language?.capitalize() ?? 'Auto'} ',
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 4.0,
@@ -281,7 +284,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
Future<void> updateLanguage(String language) async {
final transaction = editorState.transaction
..updateNode(node, {
- CodeBlockKeys.language: language,
+ CodeBlockKeys.language: language == 'auto' ? null : language,
})
..afterSelection = Selection.collapse(
node.path,