1
This commit is contained in:
1 parent
a8b7bdf606
commit
3faf9a7ae5
82 files changed
+3041
-883
No files matched your search
@@ -1020,6 +1020,13 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
required TextSpan textSpan,
|
||||
required TextStyle style,
|
||||
}) {
|
||||
try {
|
||||
final settings = _getSettingsProvider(context);
|
||||
if (!settings.enableLspCompletion || !settings.enableCodeDiagnostics) {
|
||||
return textSpan;
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
return _diagnosticController.buildDiagnosticSpans(
|
||||
context: context,
|
||||
filePath: _currentLoadedPath ?? widget.filePath,
|
||||
@@ -1218,6 +1225,8 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
bool showLineNumbers = true;
|
||||
bool pinLineNumbers = true;
|
||||
bool enableLspCompletion = true;
|
||||
bool enableCodeCompletion = true;
|
||||
bool enableCodeDiagnostics = true;
|
||||
try {
|
||||
final settings = _getSettingsProvider(context, listen: true);
|
||||
activeTheme = settings.editorTheme;
|
||||
@@ -1229,6 +1238,8 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
keyboardConfig = settings.virtualKeyboardConfig;
|
||||
activeEditorFont = settings.editorFont;
|
||||
enableLspCompletion = settings.enableLspCompletion;
|
||||
enableCodeCompletion = settings.enableCodeCompletion;
|
||||
enableCodeDiagnostics = settings.enableCodeDiagnostics;
|
||||
if (_currentIndentSize != null && _currentIndentSize != settings.indentSize) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) _loadFileContent();
|
||||
@@ -1236,6 +1247,9 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
final bool effectiveCompletion = enableLspCompletion && enableCodeCompletion;
|
||||
final bool effectiveDiagnostics = enableLspCompletion && enableCodeDiagnostics;
|
||||
|
||||
final double displayFontSize = _activeZoomFontSize ?? activeFontSize;
|
||||
|
||||
return Container(
|
||||
@@ -1262,7 +1276,7 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
final promptsBuilder = SmartCodeAutocompletePromptsBuilder(
|
||||
controller: controller,
|
||||
filePath: _currentLoadedPath ?? widget.filePath,
|
||||
enableLspCompletion: enableLspCompletion,
|
||||
enableLspCompletion: effectiveCompletion,
|
||||
);
|
||||
return EditorOverlayScope(
|
||||
key: ValueKey(_currentLoadedPath),
|
||||
@@ -1316,6 +1330,7 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
controller: editingController,
|
||||
notifier: notifier,
|
||||
lineDecorationBuilder: (lineIndex) {
|
||||
if (!effectiveDiagnostics) return null;
|
||||
final filePath = _currentLoadedPath ?? widget.filePath;
|
||||
if (filePath == null) return null;
|
||||
final diags = LspDiagnosticsStore.instance.getDiagnosticsForLine(filePath, lineIndex);
|
||||
@@ -1406,7 +1421,7 @@ class _CodeEditorWidgetState extends State<CodeEditorWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_currentCursorLine >= 0 && (_currentLoadedPath ?? widget.filePath) != null) ...[
|
||||
if (effectiveDiagnostics && _currentCursorLine >= 0 && (_currentLoadedPath ?? widget.filePath) != null) ...[
|
||||
Builder(
|
||||
builder: (ctx) {
|
||||
final diags = LspDiagnosticsStore.instance.getDiagnosticsForLine(
|
||||
|
||||
@@ -68,6 +68,18 @@ class ConflictLine {
|
||||
role == ConflictLineRole.oursContent ||
|
||||
role == ConflictLineRole.baseContent ||
|
||||
role == ConflictLineRole.theirsContent;
|
||||
|
||||
bool get isOurs =>
|
||||
role == ConflictLineRole.oursHeader ||
|
||||
role == ConflictLineRole.oursContent;
|
||||
|
||||
bool get isTheirs =>
|
||||
role == ConflictLineRole.theirsHeader ||
|
||||
role == ConflictLineRole.theirsContent;
|
||||
|
||||
bool get isBase =>
|
||||
role == ConflictLineRole.baseHeader ||
|
||||
role == ConflictLineRole.baseContent;
|
||||
}
|
||||
|
||||
/// 把冲突文件内容摊平成可渲染的行序列
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../../providers/git_provider.dart';
|
||||
import '../../providers/tab_provider.dart';
|
||||
import '../../utils/dialog_utils.dart';
|
||||
import '../../utils/git_error_mapper.dart';
|
||||
import '../../views/main_view.dart';
|
||||
import 'git_conflict_resolve_page.dart';
|
||||
|
||||
/// 冲突解决面板(底部弹出)
|
||||
@@ -518,9 +519,6 @@ class _ConflictFileTile extends StatelessWidget {
|
||||
await provider.refreshConflictState();
|
||||
if (!context.mounted) return;
|
||||
|
||||
// 先收起面板与抽屉,再压入解决页 —— 否则返回时层级会错乱
|
||||
Navigator.of(context).maybePop();
|
||||
|
||||
await Navigator.of(context).push(
|
||||
GitConflictResolvePage.route(file: file, gitProvider: provider),
|
||||
);
|
||||
@@ -539,11 +537,9 @@ class _ConflictFileTile extends StatelessWidget {
|
||||
await tabProvider.openFile(file.absolutePath);
|
||||
if (!context.mounted) return;
|
||||
|
||||
// 先收起 bottom sheet 面板,再显式关闭抽屉。
|
||||
// 这里不能用连续两次 maybePop():抽屉是 Scaffold 管理的路由,
|
||||
// 用 closeDrawer() 才是项目内一致且可靠的做法(见 file_item_widget)。
|
||||
Navigator.of(context).maybePop();
|
||||
Scaffold.maybeOf(context)?.closeDrawer();
|
||||
// 先收起 bottom sheet 冲突面板,再关闭侧边栏抽屉,直达主代码编辑区
|
||||
Navigator.of(context).pop();
|
||||
MainView.closeDrawerIfOpen();
|
||||
}
|
||||
|
||||
Future<void> _takeSide(
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user