1
This commit is contained in:
1 parent
a8b7bdf606
commit
3faf9a7ae5
82 files changed
+3041
-883
No files matched your search
@@ -290,6 +290,8 @@ class _CodeCompletionManagementViewState
|
||||
if (settings == null) return const SizedBox.shrink();
|
||||
|
||||
final colorScheme = theme.colorScheme;
|
||||
final isMasterEnabled = settings.enableLspCompletion;
|
||||
|
||||
return Card(
|
||||
elevation: 0,
|
||||
color: colorScheme.surfaceContainerHighest.withValues(alpha: 0.35),
|
||||
@@ -312,12 +314,51 @@ class _CodeCompletionManagementViewState
|
||||
),
|
||||
),
|
||||
),
|
||||
// 语言服务总开关
|
||||
SwitchListTile(
|
||||
key: const ValueKey('lsp_master_switch'),
|
||||
secondary: const Icon(Icons.hub_outlined),
|
||||
title: Text(l10n.lspCompletionTitle),
|
||||
value: settings.enableLspCompletion,
|
||||
subtitle: Text(l10n.lspCompletionSubtitle),
|
||||
value: isMasterEnabled,
|
||||
onChanged: (val) => settings.setEnableLspCompletion(val),
|
||||
),
|
||||
Divider(
|
||||
height: 1,
|
||||
indent: 16,
|
||||
endIndent: 16,
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.4),
|
||||
),
|
||||
// 分开关 1:代码补全
|
||||
SwitchListTile(
|
||||
key: const ValueKey('code_completion_sub_switch'),
|
||||
contentPadding: const EdgeInsets.only(left: 32, right: 16),
|
||||
secondary: Icon(
|
||||
Icons.auto_awesome_outlined,
|
||||
color: isMasterEnabled ? null : colorScheme.onSurface.withValues(alpha: 0.38),
|
||||
),
|
||||
title: Text(l10n.codeCompletionSwitchTitle),
|
||||
subtitle: Text(l10n.codeCompletionSwitchSubtitle),
|
||||
value: settings.enableCodeCompletion,
|
||||
onChanged: isMasterEnabled
|
||||
? (val) => settings.setEnableCodeCompletion(val)
|
||||
: null,
|
||||
),
|
||||
// 分开关 2:代码纠错
|
||||
SwitchListTile(
|
||||
key: const ValueKey('code_diagnostics_sub_switch'),
|
||||
contentPadding: const EdgeInsets.only(left: 32, right: 16),
|
||||
secondary: Icon(
|
||||
Icons.spellcheck_rounded,
|
||||
color: isMasterEnabled ? null : colorScheme.onSurface.withValues(alpha: 0.38),
|
||||
),
|
||||
title: Text(l10n.codeDiagnosticsSwitchTitle),
|
||||
subtitle: Text(l10n.codeDiagnosticsSwitchSubtitle),
|
||||
value: settings.enableCodeDiagnostics,
|
||||
onChanged: isMasterEnabled
|
||||
? (val) => settings.setEnableCodeDiagnostics(val)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -38,6 +38,16 @@ import 'package:provider/provider.dart';
|
||||
class MainView extends StatefulWidget {
|
||||
const MainView({super.key});
|
||||
|
||||
/// 全局主页面 Scaffold Key,用于从任何弹窗、底部面板或子页面关闭主界面抽屉侧边栏
|
||||
static final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
/// 方便调用的关闭主界面侧边栏抽屉辅助方法
|
||||
static void closeDrawerIfOpen() {
|
||||
if (scaffoldKey.currentState?.isDrawerOpen ?? false) {
|
||||
scaffoldKey.currentState?.closeDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
/// 清除指定语言或全部语言的防打扰提示记录(卸载组件后恢复提示资格并重置当前文件检查)
|
||||
static void clearPromptedLanguage(String? languageId) {
|
||||
_MainViewState.clearPromptedLanguage(languageId);
|
||||
@@ -653,6 +663,7 @@ class _MainViewState extends State<MainView> {
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
key: MainView.scaffoldKey,
|
||||
appBar: CodeEditorAppBar(
|
||||
filePath: currentFile,
|
||||
rootPath: rootPath,
|
||||
|
||||
Reference in new issue
Block a user