mbeditor 0.14.2 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -0
- data/app/assets/javascripts/mbeditor/application.js +5 -1
- data/app/assets/javascripts/mbeditor/collaboration_identity.js +4 -2
- data/app/assets/javascripts/mbeditor/collaboration_service.js +74 -2
- data/app/assets/javascripts/mbeditor/components/AiRoundTripModal.js +452 -0
- data/app/assets/javascripts/mbeditor/components/ChangelogView.js +1 -1
- data/app/assets/javascripts/mbeditor/components/CombinedFileView.js +3 -2
- data/app/assets/javascripts/mbeditor/components/EditorPanel.js +28 -27
- data/app/assets/javascripts/mbeditor/components/FileHistoryPanel.js +2 -7
- data/app/assets/javascripts/mbeditor/components/FileTree.js +144 -4
- data/app/assets/javascripts/mbeditor/components/GitPanel.js +1 -1
- data/app/assets/javascripts/mbeditor/components/ImportConflictModal.js +7 -68
- data/app/assets/javascripts/mbeditor/components/ImportDialog.js +2 -16
- data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +340 -472
- data/app/assets/javascripts/mbeditor/components/ModalDialog.js +203 -0
- data/app/assets/javascripts/mbeditor/components/PastePlaceModal.js +1 -9
- data/app/assets/javascripts/mbeditor/components/Popover.js +88 -0
- data/app/assets/javascripts/mbeditor/components/PopupMenu.js +166 -0
- data/app/assets/javascripts/mbeditor/components/ProblemsPanel.js +8 -4
- data/app/assets/javascripts/mbeditor/components/QuickOpenDialog.js +5 -7
- data/app/assets/javascripts/mbeditor/components/SettingsModal.js +3 -14
- data/app/assets/javascripts/mbeditor/components/ShortcutHelp.js +4 -25
- data/app/assets/javascripts/mbeditor/components/TabBar.js +15 -32
- data/app/assets/javascripts/mbeditor/components/TestResultsPanel.js +2 -7
- data/app/assets/javascripts/mbeditor/editor_plugins.js +3 -23
- data/app/assets/javascripts/mbeditor/file_service.js +1 -1
- data/app/assets/javascripts/mbeditor/git_service.js +0 -7
- data/app/assets/javascripts/mbeditor/patch_select.js +156 -0
- data/app/assets/javascripts/mbeditor/tab_manager.js +19 -0
- data/app/assets/stylesheets/mbeditor/application.css +7 -110
- data/app/assets/stylesheets/mbeditor/editor.css +195 -192
- data/app/assets/stylesheets/mbeditor/glass.css +1 -1
- data/app/channels/mbeditor/collaboration_channel.rb +24 -5
- data/app/controllers/mbeditor/editors_controller.rb +75 -38
- data/app/controllers/mbeditor/git_controller.rb +1 -12
- data/app/services/mbeditor/ai_bundle_service.rb +181 -0
- data/app/services/mbeditor/archive_service.rb +43 -6
- data/app/services/mbeditor/availability_probe.rb +2 -2
- data/app/services/mbeditor/code_search_service.rb +1 -3
- data/app/services/mbeditor/collaboration_doc_store.rb +37 -1
- data/app/services/mbeditor/exclusion_matcher.rb +0 -4
- data/app/services/mbeditor/file_import_service.rb +4 -1
- data/app/services/mbeditor/file_operation_service.rb +3 -3
- data/app/services/mbeditor/git_service.rb +11 -45
- data/app/services/mbeditor/js_definition_service.rb +1 -0
- data/app/services/mbeditor/model_graph_service.rb +1 -0
- data/app/services/mbeditor/patch_apply_service.rb +185 -0
- data/app/services/mbeditor/rails_related_files_service.rb +1 -1
- data/app/services/mbeditor/redmine_config_error.rb +6 -0
- data/app/services/mbeditor/redmine_disabled_error.rb +10 -0
- data/app/services/mbeditor/redmine_service.rb +0 -8
- data/app/services/mbeditor/ruby_definition_service.rb +1 -0
- data/app/services/mbeditor/schema_service.rb +1 -0
- data/app/services/mbeditor/test_runner_service.rb +1 -1
- data/lib/mbeditor/rack/silence_ping_request.rb +14 -14
- data/lib/mbeditor/route_map.rb +5 -2
- data/lib/mbeditor/ruby_lsp_client.rb +7 -26
- data/lib/mbeditor/version.rb +1 -1
- data/public/monaco-editor/VERSIONS +2 -1
- data/public/monaco-editor/monaco.js +226 -226
- metadata +11 -4
- data/app/assets/javascripts/mbeditor/components/CommitGraph.js +0 -65
- data/app/services/mbeditor/git_commit_graph_service.rb +0 -62
|
@@ -7,12 +7,7 @@ var useEffect = _React.useEffect;
|
|
|
7
7
|
var useRef = _React.useRef;
|
|
8
8
|
|
|
9
9
|
var menuItem = function menuItem(icon, label, onClick) {
|
|
10
|
-
return React.createElement(
|
|
11
|
-
'div',
|
|
12
|
-
{ className: 'ide-tab-context-menu-item', onClick: onClick },
|
|
13
|
-
React.createElement('i', { className: icon }),
|
|
14
|
-
label
|
|
15
|
-
);
|
|
10
|
+
return React.createElement(window.MenuItem, { icon: icon, label: label, onClick: onClick });
|
|
16
11
|
};
|
|
17
12
|
|
|
18
13
|
// Clamps a position:fixed, content-sized popup menu into the viewport.
|
|
@@ -116,14 +111,6 @@ var TabBar = function TabBar(_ref) {
|
|
|
116
111
|
// or switching a tab can move the active one out of view.
|
|
117
112
|
}, [activeId, tabs.length]);
|
|
118
113
|
|
|
119
|
-
// Close context menu on outside click (bubble phase so onMouseDown on the menu can stop it)
|
|
120
|
-
useEffect(function () {
|
|
121
|
-
if (!tabContextMenu) return;
|
|
122
|
-
var handler = function () { setTabContextMenu(null); };
|
|
123
|
-
document.addEventListener('mousedown', handler);
|
|
124
|
-
return function () { document.removeEventListener('mousedown', handler); };
|
|
125
|
-
}, [tabContextMenu]);
|
|
126
|
-
|
|
127
114
|
// Clamp into view whenever the menu opens at a new position.
|
|
128
115
|
useEffect(function () {
|
|
129
116
|
if (tabContextMenu) window.clampMenuIntoView(tabContextMenuRef.current);
|
|
@@ -140,7 +127,7 @@ var TabBar = function TabBar(_ref) {
|
|
|
140
127
|
}
|
|
141
128
|
} },
|
|
142
129
|
tabs.map(function (tab) {
|
|
143
|
-
var isSpecial = tab.
|
|
130
|
+
var isSpecial = tab.isDiff || tab.isPreview;
|
|
144
131
|
return React.createElement(
|
|
145
132
|
'div',
|
|
146
133
|
{
|
|
@@ -252,30 +239,26 @@ var TabBar = function TabBar(_ref) {
|
|
|
252
239
|
React.createElement('i', { className: 'fas fa-plus' })
|
|
253
240
|
)
|
|
254
241
|
),
|
|
242
|
+
// A PopupMenu (popover + arrow-key buttons): outside clicks and Esc close
|
|
243
|
+
// it natively (onDismiss). Shares .context-menu's themed surface with the
|
|
244
|
+
// explorer menu; it used to carry hard-coded dark colours inline and
|
|
245
|
+
// ignored light themes.
|
|
255
246
|
tabContextMenu && React.createElement(
|
|
256
|
-
|
|
247
|
+
window.PopupMenu,
|
|
257
248
|
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
background: '#252526',
|
|
266
|
-
border: '1px solid #454545',
|
|
267
|
-
borderRadius: '4px',
|
|
268
|
-
boxShadow: '0 4px 12px rgba(0,0,0,0.5)',
|
|
269
|
-
minWidth: '160px',
|
|
270
|
-
padding: '4px 0'
|
|
271
|
-
},
|
|
272
|
-
onMouseDown: function(e) { e.stopPropagation(); }
|
|
249
|
+
key: tabContextMenu.x + ',' + tabContextMenu.y,
|
|
250
|
+
label: tabContextMenu.tab.name,
|
|
251
|
+
className: 'context-menu ide-tab-context-menu',
|
|
252
|
+
popoverRef: tabContextMenuRef,
|
|
253
|
+
style: { top: tabContextMenu.y, left: tabContextMenu.x, minWidth: '160px' },
|
|
254
|
+
onDismiss: function () { setTabContextMenu(null); },
|
|
255
|
+
onContextMenu: function (e) { e.preventDefault(); }
|
|
273
256
|
},
|
|
274
257
|
menuItem('fas fa-times', 'Close', function() { setTabContextMenu(null); onClose(tabContextMenu.tab.id); }),
|
|
275
258
|
onCloseOthers && menuItem('fas fa-times-circle', 'Close Others', function() { setTabContextMenu(null); onCloseOthers(tabContextMenu.tab.id); }),
|
|
276
259
|
onCloseSaved && menuItem('fas fa-check', 'Close Saved', function() { setTabContextMenu(null); onCloseSaved(); }),
|
|
277
260
|
onCloseAll && menuItem('fas fa-times', 'Close All', function() { setTabContextMenu(null); onCloseAll(); }),
|
|
278
|
-
React.createElement(
|
|
261
|
+
React.createElement(window.MenuSeparator),
|
|
279
262
|
onShowHistory && menuItem('fas fa-history', 'File History', function() {
|
|
280
263
|
setTabContextMenu(null);
|
|
281
264
|
onShowHistory(tabContextMenu.tab.path);
|
|
@@ -25,12 +25,8 @@ var TestResultsPanel = function TestResultsPanel(_ref) {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
return React.createElement(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
React.createElement('div', { className: 'ide-modal-backdrop', onClick: onClose }),
|
|
31
|
-
React.createElement(
|
|
32
|
-
'div',
|
|
33
|
-
{ className: 'ide-modal-panel' },
|
|
28
|
+
window.ModalDialog,
|
|
29
|
+
{ className: 'ide-modal-panel', label: 'Test results', onDismiss: onClose },
|
|
34
30
|
React.createElement(
|
|
35
31
|
'div',
|
|
36
32
|
{ className: 'ide-file-history-header' },
|
|
@@ -156,7 +152,6 @@ var TestResultsPanel = function TestResultsPanel(_ref) {
|
|
|
156
152
|
)
|
|
157
153
|
)
|
|
158
154
|
)
|
|
159
|
-
)
|
|
160
155
|
);
|
|
161
156
|
};
|
|
162
157
|
|
|
@@ -402,11 +402,6 @@
|
|
|
402
402
|
if (status !== 422 && data.lspState !== 'failed') return;
|
|
403
403
|
|
|
404
404
|
window.MBEDITOR_RUBY_LSP_DISABLED_UNTIL = Date.now() + LSP_BACKOFF_MS;
|
|
405
|
-
window.MBEDITOR_RUBY_LSP_REASON = data.reason || data.error ||
|
|
406
|
-
(data.lspState === 'failed' ? 'ruby-lsp crashed repeatedly' : 'ruby-lsp is unavailable');
|
|
407
|
-
try {
|
|
408
|
-
window.dispatchEvent(new CustomEvent('mbeditor:lsp-health'));
|
|
409
|
-
} catch (e) { /* CustomEvent unavailable — the guard still works */ }
|
|
410
405
|
}
|
|
411
406
|
|
|
412
407
|
function lspBackedOff() {
|
|
@@ -448,7 +443,7 @@
|
|
|
448
443
|
function auditLspName(lspMethod) {
|
|
449
444
|
if (lspMethod === 'formatting') return 'format';
|
|
450
445
|
if (lspMethod === 'prepare_rename') return 'rename';
|
|
451
|
-
return lspMethod.replace(/_(\w)/g, function (
|
|
446
|
+
return lspMethod.replace(/_(\w)/g, function (_m, c) { return c.toUpperCase(); });
|
|
452
447
|
}
|
|
453
448
|
|
|
454
449
|
function recLsp(lspMethod, startedAt, ok) {
|
|
@@ -738,17 +733,6 @@
|
|
|
738
733
|
return new Array(tabSize + 1).join(' ');
|
|
739
734
|
}
|
|
740
735
|
|
|
741
|
-
function rubyClosingIndent(model, cursorLineNumber, openerLine) {
|
|
742
|
-
var cursorIndent = leadingWhitespace(model.getLineContent(cursorLineNumber));
|
|
743
|
-
var indentUnit = rubyIndentUnit(model, cursorIndent);
|
|
744
|
-
|
|
745
|
-
if (cursorIndent.length >= indentUnit.length) {
|
|
746
|
-
return cursorIndent.slice(0, cursorIndent.length - indentUnit.length);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
return leadingWhitespace(openerLine);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
736
|
function isRubyBlockStart(line) {
|
|
753
737
|
var trimmed = line.trim();
|
|
754
738
|
if (!trimmed || trimmed[0] === '#') return false;
|
|
@@ -1092,12 +1076,8 @@
|
|
|
1092
1076
|
}
|
|
1093
1077
|
|
|
1094
1078
|
// Place the first tab stop ($1 or ${1}) at cursor; strip remaining markers
|
|
1095
|
-
var withTabStop = expanded.replace(/\$\{[0-9]+:[^}]*\}|\$\{[0-9]+\}|\$[0-9]+/g, function(m, offset, str) {
|
|
1096
|
-
// Keep first occurrence as cursor position marker (replaced below), remove rest
|
|
1097
|
-
return m;
|
|
1098
|
-
});
|
|
1099
1079
|
var firstTabStop = null;
|
|
1100
|
-
var expandedClean =
|
|
1080
|
+
var expandedClean = expanded.replace(/\$\{1:[^}]*\}|\$\{1\}|\$1/g, function() {
|
|
1101
1081
|
if (firstTabStop === null) { firstTabStop = true; return '\x00'; }
|
|
1102
1082
|
return '';
|
|
1103
1083
|
}).replace(/\$\{[0-9]+:[^}]*\}|\$\{[0-9]+\}|\$[0-9]+/g, '');
|
|
@@ -2793,7 +2773,7 @@
|
|
|
2793
2773
|
});
|
|
2794
2774
|
});
|
|
2795
2775
|
|
|
2796
|
-
function legacyRubyHover(model,
|
|
2776
|
+
function legacyRubyHover(model, _position, token, wordInfo) {
|
|
2797
2777
|
var word = wordInfo.word;
|
|
2798
2778
|
{
|
|
2799
2779
|
// Uppercase first letter → likely a module/class name.
|
|
@@ -370,7 +370,7 @@ var FileService = (function () {
|
|
|
370
370
|
}).then(function(data) {
|
|
371
371
|
entry.resolvedAt = Date.now();
|
|
372
372
|
return data;
|
|
373
|
-
}).catch(function(
|
|
373
|
+
}).catch(function() {
|
|
374
374
|
// Remove from cache on failure/abort so a real open falls back to a fresh fetch
|
|
375
375
|
prefetchCache.delete(path);
|
|
376
376
|
return null;
|
|
@@ -265,12 +265,6 @@ var GitService = (function () {
|
|
|
265
265
|
_fileHistoryCache = {};
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
function fetchCommitGraph() {
|
|
269
|
-
return axios.get(window.mbeditorBasePath() + '/git/commit_graph').then(function(res) {
|
|
270
|
-
return res.data;
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
|
|
274
268
|
function fetchCommitDetail(sha) {
|
|
275
269
|
return axios.get(window.mbeditorBasePath() + '/git/commit_detail?sha=' + encodeURIComponent(sha)).then(function(res) {
|
|
276
270
|
return res.data;
|
|
@@ -286,7 +280,6 @@ var GitService = (function () {
|
|
|
286
280
|
fetchLineDiff: fetchLineDiff,
|
|
287
281
|
invalidateLineDiff: invalidateLineDiff,
|
|
288
282
|
fetchFileHistory: fetchFileHistory,
|
|
289
|
-
fetchCommitGraph: fetchCommitGraph,
|
|
290
283
|
fetchCommitDetail: fetchCommitDetail
|
|
291
284
|
};
|
|
292
285
|
})();
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Hunk-level selection over a unified diff, for the AI modal's Apply tab.
|
|
4
|
+
// Pure text in, text out: parse() splits a patch into files and hunks without
|
|
5
|
+
// altering a byte, and build() joins the chosen ones back. Header lines are
|
|
6
|
+
// kept verbatim and unselected hunks are dropped; the stale counts and start
|
|
7
|
+
// lines that leaves are handled by the server's `git apply --recount`.
|
|
8
|
+
//
|
|
9
|
+
// Created, deleted, renamed and binary files, and any file with no hunks, are
|
|
10
|
+
// atomic: all or nothing.
|
|
11
|
+
(function () {
|
|
12
|
+
function splitLines(text) {
|
|
13
|
+
return text.match(/[^\n]*\n|[^\n]+$/g) || [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function bare(line) {
|
|
17
|
+
return line.replace(/\r?\n$/, '');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// git quotes a path with non-ASCII or special characters ("caf\303\251.txt").
|
|
21
|
+
// Escapes become %XX so decodeURIComponent reads the octal bytes as UTF-8.
|
|
22
|
+
var QUOTED_ESCAPES = { n: '%0A', t: '%09', r: '%0D', a: '%07', b: '%08', f: '%0C', v: '%0B', '"': '%22', '\\': '%5C' };
|
|
23
|
+
function unquote(p) {
|
|
24
|
+
if (p.length < 2 || p.charAt(0) !== '"' || p.charAt(p.length - 1) !== '"') return p;
|
|
25
|
+
var out = p.slice(1, -1).replace(/\\([0-7]{3}|[\s\S])|%/g, function (m, esc) {
|
|
26
|
+
if (m === '%') return '%25';
|
|
27
|
+
if (/^[0-7]{3}$/.test(esc)) return '%' + ('0' + parseInt(esc, 8).toString(16)).slice(-2).toUpperCase();
|
|
28
|
+
return QUOTED_ESCAPES[esc] || esc;
|
|
29
|
+
});
|
|
30
|
+
try { return decodeURIComponent(out); } catch (e) { return p; }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Where the hunk whose "@@" header is lines[i] ends, by its own counts, or -1
|
|
34
|
+
// when the body does not match them (hand-edited or miscounted).
|
|
35
|
+
function hunkEnd(lines, i) {
|
|
36
|
+
var m = /^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/.exec(lines[i]);
|
|
37
|
+
if (!m) return -1;
|
|
38
|
+
var oldLeft = m[1] === undefined ? 1 : +m[1];
|
|
39
|
+
var newLeft = m[2] === undefined ? 1 : +m[2];
|
|
40
|
+
var j = i + 1;
|
|
41
|
+
while (oldLeft > 0 || newLeft > 0) {
|
|
42
|
+
var c = (lines[j] || '').charAt(0);
|
|
43
|
+
if (c === ' ') { oldLeft--; newLeft--; }
|
|
44
|
+
else if (c === '-') oldLeft--;
|
|
45
|
+
else if (c === '+') newLeft--;
|
|
46
|
+
else if (c !== '\\') return -1;
|
|
47
|
+
if (oldLeft < 0 || newLeft < 0) return -1;
|
|
48
|
+
j++;
|
|
49
|
+
}
|
|
50
|
+
while ((lines[j] || '').charAt(0) === '\\') j++;
|
|
51
|
+
return j;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function describe(f) {
|
|
55
|
+
var h = f.header;
|
|
56
|
+
var m;
|
|
57
|
+
f.from = null;
|
|
58
|
+
if (/^(GIT binary patch|Binary files )/m.test(h)) f.status = 'binary';
|
|
59
|
+
else if (/^rename from /m.test(h)) f.status = 'renamed';
|
|
60
|
+
else if (/^new file mode /m.test(h) || /^--- \/dev\/null\r?$/m.test(h)) f.status = 'created';
|
|
61
|
+
else if (/^deleted file mode /m.test(h) || /^\+\+\+ \/dev\/null\r?$/m.test(h)) f.status = 'deleted';
|
|
62
|
+
else f.status = 'modified';
|
|
63
|
+
|
|
64
|
+
if (f.status === 'renamed') {
|
|
65
|
+
f.from = (m = /^rename from (.+)$/m.exec(h)) ? unquote(bare(m[1])) : null;
|
|
66
|
+
f.path = (m = /^rename to (.+)$/m.exec(h)) ? unquote(bare(m[1])) : '';
|
|
67
|
+
} else if ((m = /^\+\+\+ (?!\/dev\/null)(.+)$/m.exec(h)) || (m = /^--- (?!\/dev\/null)(.+)$/m.exec(h))) {
|
|
68
|
+
f.path = unquote(bare(m[1]).replace(/\t.*$/, '')).replace(/^[ab]\//, '');
|
|
69
|
+
} else if ((m = /^diff --git (?:"a\/.*"|a\/.+) ("b\/.*"|b\/.+)$/m.exec(h))) {
|
|
70
|
+
f.path = unquote(bare(m[1])).replace(/^b\//, '');
|
|
71
|
+
} else {
|
|
72
|
+
f.path = '';
|
|
73
|
+
}
|
|
74
|
+
f.atomic = f.status !== 'modified' || f.hunks.length === 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function parse(text) {
|
|
78
|
+
var lines = splitLines(text);
|
|
79
|
+
var files = [];
|
|
80
|
+
var file = null;
|
|
81
|
+
var inHunk = false;
|
|
82
|
+
var hunkUntil = 0;
|
|
83
|
+
lines.forEach(function (l, i) {
|
|
84
|
+
var startsFile = l.indexOf('diff --git ') === 0 ||
|
|
85
|
+
!file ||
|
|
86
|
+
// A plain (non-git) patch has no per-file marker. Three lines together
|
|
87
|
+
// are unambiguous where a removed "-- x" line alone is not.
|
|
88
|
+
(inHunk && i >= hunkUntil && l.indexOf('--- ') === 0 && (lines[i + 1] || '').indexOf('+++ ') === 0 && (lines[i + 2] || '').indexOf('@@') === 0);
|
|
89
|
+
if (startsFile) {
|
|
90
|
+
file = { header: '', hunks: [] };
|
|
91
|
+
files.push(file);
|
|
92
|
+
inHunk = false;
|
|
93
|
+
}
|
|
94
|
+
if (l.indexOf('@@') === 0) {
|
|
95
|
+
file.hunks.push('');
|
|
96
|
+
inHunk = true;
|
|
97
|
+
hunkUntil = Math.max(hunkEnd(lines, i), 0);
|
|
98
|
+
}
|
|
99
|
+
if (inHunk) file.hunks[file.hunks.length - 1] += l;
|
|
100
|
+
else file.header += l;
|
|
101
|
+
});
|
|
102
|
+
files.forEach(describe);
|
|
103
|
+
return files;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// selection[i] is a boolean per hunk of files[i]; an atomic file reads only
|
|
107
|
+
// selection[i][0].
|
|
108
|
+
function defaultSelection(files) {
|
|
109
|
+
return files.map(function (f) {
|
|
110
|
+
return f.atomic ? [true] : f.hunks.map(function () { return true; });
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function build(files, selection) {
|
|
115
|
+
return files.map(function (f, i) {
|
|
116
|
+
var s = selection[i] || [];
|
|
117
|
+
if (f.atomic) return s[0] ? f.header + f.hunks.join('') : '';
|
|
118
|
+
var keep = f.hunks.filter(function (_h, j) { return s[j]; });
|
|
119
|
+
return keep.length ? f.header + keep.join('') : '';
|
|
120
|
+
}).join('');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Units the user chooses between: one per atomic file, one per hunk otherwise.
|
|
124
|
+
function count(files, selection) {
|
|
125
|
+
var selected = 0;
|
|
126
|
+
var total = 0;
|
|
127
|
+
files.forEach(function (f, i) {
|
|
128
|
+
var s = selection[i] || [];
|
|
129
|
+
if (f.atomic) { total += 1; if (s[0]) selected += 1; return; }
|
|
130
|
+
total += f.hunks.length;
|
|
131
|
+
f.hunks.forEach(function (_h, j) { if (s[j]) selected += 1; });
|
|
132
|
+
});
|
|
133
|
+
return { selected: selected, total: total };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Paths of the files that would be written, old name of a rename included.
|
|
137
|
+
// +serverFiles+ (the check response's files, in patch order) is authoritative
|
|
138
|
+
// when it lines up with the parse, since git decodes quoted names itself.
|
|
139
|
+
function touchedPaths(files, selection, serverFiles) {
|
|
140
|
+
var out = [];
|
|
141
|
+
var useServer = serverFiles && serverFiles.length === files.length;
|
|
142
|
+
files.forEach(function (f, i) {
|
|
143
|
+
var s = selection[i] || [];
|
|
144
|
+
var on = f.atomic ? !!s[0] : s.some(Boolean);
|
|
145
|
+
if (!on) return;
|
|
146
|
+
var src = useServer ? serverFiles[i] : f;
|
|
147
|
+
out.push(src.path);
|
|
148
|
+
if (src.from) out.push(src.from);
|
|
149
|
+
});
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
window.MbeditorPatchSelect = {
|
|
154
|
+
parse: parse, build: build, count: count, defaultSelection: defaultSelection, touchedPaths: touchedPaths
|
|
155
|
+
};
|
|
156
|
+
})();
|
|
@@ -781,6 +781,23 @@ var TabManager = (function () {
|
|
|
781
781
|
EditorStore.setState({ panes: newPanes });
|
|
782
782
|
}
|
|
783
783
|
|
|
784
|
+
// Ask the editor for `path` to take keyboard focus once it has loaded and
|
|
785
|
+
// Monaco exists (EditorPanel's focusOnLoad effect does it and clears the
|
|
786
|
+
// flag). For openers that have no line to jump to — a gotoLine already
|
|
787
|
+
// focuses. Quick Open needs it: closing its dialog hands focus back to the
|
|
788
|
+
// editor that was focused before, and switching tabs unmounts that editor
|
|
789
|
+
// (EditorPanel is keyed by tab id), which left focus on <body>.
|
|
790
|
+
function requestFocus(path) {
|
|
791
|
+
var state = EditorStore.getState();
|
|
792
|
+
var pane = state.panes.find(function(p) { return p.id === state.focusedPaneId && p.activeTabId === path; }) ||
|
|
793
|
+
state.panes.find(function(p) { return p.activeTabId === path; });
|
|
794
|
+
if (pane) _updateTab(pane.id, path, { focusOnLoad: true });
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function clearFocusRequest(paneId, path) {
|
|
798
|
+
_updateTab(paneId, path, { focusOnLoad: false });
|
|
799
|
+
}
|
|
800
|
+
|
|
784
801
|
function clearGotoLine(paneId, path) {
|
|
785
802
|
_updateTab(paneId, path, { gotoLine: null, gotoCol: null, gotoEndCol: null });
|
|
786
803
|
}
|
|
@@ -835,6 +852,8 @@ var TabManager = (function () {
|
|
|
835
852
|
reorderTabInPane: reorderTabInPane,
|
|
836
853
|
moveTabToPane: moveTabToPane,
|
|
837
854
|
clearGotoLine: clearGotoLine,
|
|
855
|
+
requestFocus: requestFocus,
|
|
856
|
+
clearFocusRequest: clearFocusRequest,
|
|
838
857
|
navigateBack: navigateBack,
|
|
839
858
|
navigateForward: navigateForward,
|
|
840
859
|
closeAllTabsInPane: closeAllTabsInPane,
|
|
@@ -8,16 +8,6 @@
|
|
|
8
8
|
/* ── Git & Code Review Styles ───────────────────────────────────────── */
|
|
9
9
|
|
|
10
10
|
/* Status Bar Git Sync */
|
|
11
|
-
.status-bar-git {
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
}
|
|
14
|
-
.status-bar-git:hover {
|
|
15
|
-
background-color: var(--status-hover-bg);
|
|
16
|
-
}
|
|
17
|
-
.status-bar-git .branch-name {
|
|
18
|
-
margin-left: 6px;
|
|
19
|
-
font-weight: 500;
|
|
20
|
-
}
|
|
21
11
|
.git-sync-status {
|
|
22
12
|
margin-left: 6px;
|
|
23
13
|
display: flex;
|
|
@@ -90,27 +80,12 @@
|
|
|
90
80
|
background-color: var(--ide-hover-bg);
|
|
91
81
|
color: var(--ide-text);
|
|
92
82
|
}
|
|
93
|
-
.ide-diff-toggle-label {
|
|
94
|
-
display: flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
gap: 6px;
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
}
|
|
99
83
|
.ide-diff-editor-container {
|
|
100
84
|
flex: 1;
|
|
101
85
|
min-height: 0;
|
|
102
86
|
}
|
|
103
87
|
|
|
104
|
-
/* Commit
|
|
105
|
-
.ide-commit-graph {
|
|
106
|
-
padding: 8px 4px;
|
|
107
|
-
color: var(--text-main);
|
|
108
|
-
overflow-y: auto;
|
|
109
|
-
overflow-x: hidden; /* prevent long commit messages from widening the panel */
|
|
110
|
-
height: 100%;
|
|
111
|
-
background-color: var(--bg-base);
|
|
112
|
-
font-size: 12px;
|
|
113
|
-
}
|
|
88
|
+
/* Commit history rows (Git panel) */
|
|
114
89
|
/* Each commit is wrapped in a flex-column group. Spacing between groups
|
|
115
90
|
is via margin-bottom so expanding a commit never creates a pixel gap. */
|
|
116
91
|
.commit-group {
|
|
@@ -286,7 +261,6 @@
|
|
|
286
261
|
transition: background 0.1s;
|
|
287
262
|
}
|
|
288
263
|
.git-commit-row:hover { background: var(--bg-hover); }
|
|
289
|
-
.git-commit-row.commit-local .commit-dot-small { background: var(--ide-success); border-color: var(--ide-success); }
|
|
290
264
|
|
|
291
265
|
.git-commit-expand-icon {
|
|
292
266
|
font-size: 9px;
|
|
@@ -295,14 +269,6 @@
|
|
|
295
269
|
width: 10px;
|
|
296
270
|
text-align: center;
|
|
297
271
|
}
|
|
298
|
-
.commit-dot-small {
|
|
299
|
-
width: 8px;
|
|
300
|
-
height: 8px;
|
|
301
|
-
border-radius: 50%;
|
|
302
|
-
flex-shrink: 0;
|
|
303
|
-
background: var(--ide-bg);
|
|
304
|
-
border: 2px solid var(--ide-accent);
|
|
305
|
-
}
|
|
306
272
|
.git-commit-info {
|
|
307
273
|
flex: 1;
|
|
308
274
|
min-width: 0;
|
|
@@ -372,19 +338,11 @@
|
|
|
372
338
|
gap: 4px;
|
|
373
339
|
}
|
|
374
340
|
|
|
375
|
-
/*
|
|
376
|
-
.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
z-index: 9000;
|
|
380
|
-
background: rgba(0,0,0,0.55);
|
|
381
|
-
}
|
|
341
|
+
/* File History / Test Results panel, rendered inside ModalDialog: an in-flow
|
|
342
|
+
box that the <dialog> shell sizes to and centres. It used to centre itself
|
|
343
|
+
with position:fixed + translate, which here would collapse the shell to
|
|
344
|
+
0x0 and turn every click on the panel into a backdrop click. */
|
|
382
345
|
.ide-modal-panel {
|
|
383
|
-
position: fixed;
|
|
384
|
-
top: 50%;
|
|
385
|
-
left: 50%;
|
|
386
|
-
transform: translate(-50%, -50%);
|
|
387
|
-
z-index: 9801;
|
|
388
346
|
width: 560px;
|
|
389
347
|
max-width: 90vw;
|
|
390
348
|
max-height: 75vh;
|
|
@@ -425,10 +383,7 @@
|
|
|
425
383
|
background: rgba(241, 76, 76, 0.08);
|
|
426
384
|
}
|
|
427
385
|
|
|
428
|
-
/* File History Panel
|
|
429
|
-
.ide-file-history {
|
|
430
|
-
/* kept for .ide-file-history-header / .ide-file-history-content children */
|
|
431
|
-
}
|
|
386
|
+
/* File History Panel */
|
|
432
387
|
.ide-file-history-header {
|
|
433
388
|
display: flex;
|
|
434
389
|
justify-content: space-between;
|
|
@@ -450,65 +405,7 @@
|
|
|
450
405
|
padding: 10px;
|
|
451
406
|
}
|
|
452
407
|
|
|
453
|
-
|
|
454
|
-
position: fixed;
|
|
455
|
-
top: 50%;
|
|
456
|
-
left: 50%;
|
|
457
|
-
transform: translate(-50%, -50%);
|
|
458
|
-
width: 560px;
|
|
459
|
-
max-width: calc(100vw - 40px);
|
|
460
|
-
max-height: 70vh;
|
|
461
|
-
background: var(--bg-base);
|
|
462
|
-
border: 1px solid var(--border);
|
|
463
|
-
box-shadow: 0 8px 24px rgba(0,0,0,0.6);
|
|
464
|
-
border-radius: 6px;
|
|
465
|
-
z-index: 9001;
|
|
466
|
-
display: flex;
|
|
467
|
-
flex-direction: column;
|
|
468
|
-
overflow: hidden;
|
|
469
|
-
}
|
|
470
|
-
.ide-commit-detail-header {
|
|
471
|
-
display: flex;
|
|
472
|
-
justify-content: space-between;
|
|
473
|
-
align-items: flex-start;
|
|
474
|
-
padding: 12px 14px;
|
|
475
|
-
background: var(--bg-panel);
|
|
476
|
-
border-bottom: 1px solid var(--border);
|
|
477
|
-
flex-shrink: 0;
|
|
478
|
-
}
|
|
479
|
-
.ide-commit-detail-title {
|
|
480
|
-
font-size: 13px;
|
|
481
|
-
font-weight: 600;
|
|
482
|
-
color: var(--text-main);
|
|
483
|
-
margin-bottom: 4px;
|
|
484
|
-
}
|
|
485
|
-
.ide-commit-detail-meta {
|
|
486
|
-
font-size: 11px;
|
|
487
|
-
color: var(--ide-text-muted);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/* Git Blame Inline Annotations */
|
|
491
|
-
.ide-blame-annotation {
|
|
492
|
-
color: var(--ide-text-muted);
|
|
493
|
-
font-size: 11px;
|
|
494
|
-
font-style: italic;
|
|
495
|
-
font-family: var(--font-mono);
|
|
496
|
-
user-select: none;
|
|
497
|
-
opacity: 0.6;
|
|
498
|
-
}
|
|
499
|
-
.ide-blame-annotation-uncommitted {
|
|
500
|
-
color: var(--ide-success);
|
|
501
|
-
font-size: 11px;
|
|
502
|
-
font-style: italic;
|
|
503
|
-
font-family: var(--font-mono);
|
|
504
|
-
user-select: none;
|
|
505
|
-
opacity: 0.7;
|
|
506
|
-
}
|
|
507
|
-
.ide-blame-widget {
|
|
508
|
-
pointer-events: none;
|
|
509
|
-
white-space: pre;
|
|
510
|
-
margin-left: 10px;
|
|
511
|
-
}
|
|
408
|
+
/* Git Blame block headers */
|
|
512
409
|
.ide-blame-block-header {
|
|
513
410
|
font-size: 11px;
|
|
514
411
|
font-style: italic;
|