mbeditor 0.2.2 → 0.2.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 +2 -2
- data/app/assets/javascripts/mbeditor/components/EditorPanel.js +11 -9
- data/app/assets/javascripts/mbeditor/editor_plugins.js +8 -2
- data/app/controllers/mbeditor/editors_controller.rb +1 -1
- data/app/views/layouts/mbeditor/application.html.erb +1 -11
- data/lib/mbeditor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e51e224ae0fbb0532079e3adfc12e7539f34ce4a79b95dcbe1f53bacd8ce950
|
|
4
|
+
data.tar.gz: 95c61fee191a701f417f1391b2ebf4497134a2e16ce70357d64ad7503823c121
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cdf5f04b303617033fa6efaf97eebb89cf0d394da820004680f06aaa8b465d8bb7e61e63bc7502cfa761b607c4ca237d84f50c1fe594040168f6a90782e9f1ed
|
|
7
|
+
data.tar.gz: aaa01716158e09985dd30d1d439cc9916bc12de24aaa5cb605a7932cd921577d67fe2baf82f1dd59b72363671a308249268f475d8dbe29f2f1dc1eba748fa50f
|
data/CHANGELOG.md
CHANGED
|
@@ -5,10 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.2.
|
|
8
|
+
## [0.2.3] - 2026-04-02
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
|
-
-
|
|
11
|
+
- Released the current mainline commit as the latest tagged version.
|
|
12
12
|
|
|
13
13
|
## [0.2.1] - 2026-04-01
|
|
14
14
|
|
|
@@ -475,14 +475,14 @@ var EditorPanel = function EditorPanel(_ref) {
|
|
|
475
475
|
formatOnType: true
|
|
476
476
|
});
|
|
477
477
|
|
|
478
|
-
monacoRef.current = editor;
|
|
479
|
-
window.__mbeditorActiveEditor = editor;
|
|
480
|
-
setEditorReady(true);
|
|
481
|
-
|
|
482
478
|
if (tab.viewState) {
|
|
483
479
|
editor.restoreViewState(tab.viewState);
|
|
484
480
|
}
|
|
485
481
|
|
|
482
|
+
monacoRef.current = editor;
|
|
483
|
+
window.__mbeditorActiveEditor = editor;
|
|
484
|
+
setEditorReady(true);
|
|
485
|
+
|
|
486
486
|
// Stash the workspace-relative path on the model so code-action providers
|
|
487
487
|
// can identify which file they are operating on without needing React state.
|
|
488
488
|
var modelObj = editor.getModel();
|
|
@@ -503,11 +503,14 @@ var EditorPanel = function EditorPanel(_ref) {
|
|
|
503
503
|
editorPluginDisposable = window.MbeditorEditorPlugins.attachEditorFeatures(editor, language);
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
// Column selection only when
|
|
507
|
-
// We toggle Monaco's columnSelection option on
|
|
506
|
+
// Column selection only when Ctrl/Cmd is held during drag.
|
|
507
|
+
// We toggle Monaco's columnSelection option on Ctrl/Cmd+mousedown and reset on mouseup.
|
|
508
|
+
// Alt+mousedown without Ctrl/Cmd is suppressed (preventDefault stops Monaco's built-in Alt+drag).
|
|
508
509
|
var onColumnMouseDown = function(ev) {
|
|
509
|
-
if (ev.
|
|
510
|
+
if (ev.ctrlKey || ev.metaKey) {
|
|
510
511
|
editor.updateOptions({ columnSelection: true });
|
|
512
|
+
} else if (ev.altKey) {
|
|
513
|
+
ev.preventDefault();
|
|
511
514
|
}
|
|
512
515
|
};
|
|
513
516
|
var onColumnMouseUp = function() {
|
|
@@ -903,8 +906,7 @@ var EditorPanel = function EditorPanel(_ref) {
|
|
|
903
906
|
// Map a test method name to the best-matching line in the source file.
|
|
904
907
|
// Extracts keywords from the test name and scores each source line.
|
|
905
908
|
var mapTestToSourceLine = function(testName, sourceContent) {
|
|
906
|
-
|
|
907
|
-
var name = (testName || '').replace(/^\w+#/, '').replace(/^test_/, '').replace(/^(it |should )/, '');
|
|
909
|
+
var name = (testName || '').replace(/^test_/, '').replace(/^(it |should )/, '');
|
|
908
910
|
var tokens = name.split('_').filter(function(t) { return t.length > 1; });
|
|
909
911
|
if (tokens.length === 0) return 1;
|
|
910
912
|
|
|
@@ -385,7 +385,8 @@
|
|
|
385
385
|
indentationRules: {
|
|
386
386
|
increaseIndentPattern: /^\s*(def|class|module|if|unless|case|while|until|for|begin|elsif|else|rescue|ensure|when)\b/,
|
|
387
387
|
decreaseIndentPattern: /^\s*(end|elsif|else|rescue|ensure|when)\b/
|
|
388
|
-
}
|
|
388
|
+
},
|
|
389
|
+
wordPattern: /[a-zA-Z_]\w*[!?]?/
|
|
389
390
|
});
|
|
390
391
|
|
|
391
392
|
// Override Monaco's built-in Ruby tokenizer with a comprehensive Monarch grammar
|
|
@@ -695,7 +696,7 @@
|
|
|
695
696
|
// Calls the backend /definition endpoint (Ripper-based) and renders
|
|
696
697
|
// the method signature and any preceding # comments as hover markdown.
|
|
697
698
|
monaco.languages.registerHoverProvider('ruby', {
|
|
698
|
-
provideHover: function provideHover(model, position) {
|
|
699
|
+
provideHover: function provideHover(model, position, token) {
|
|
699
700
|
var wordInfo = model.getWordAtPosition(position);
|
|
700
701
|
if (!wordInfo) return null;
|
|
701
702
|
|
|
@@ -707,6 +708,11 @@
|
|
|
707
708
|
var currentFile = model._mbeditorPath || null;
|
|
708
709
|
|
|
709
710
|
return FileService.getDefinition(word, 'ruby').then(function(data) {
|
|
711
|
+
// If the hover was cancelled while the request was in flight (e.g. the
|
|
712
|
+
// user moved the mouse away), return null so Monaco's CancelablePromise
|
|
713
|
+
// wrapper resolves cleanly instead of throwing "Canceled".
|
|
714
|
+
if (token && token.isCancellationRequested) return null;
|
|
715
|
+
|
|
710
716
|
var results = data && Array.isArray(data.results) ? data.results : [];
|
|
711
717
|
// Filter out results that are in the file currently being edited —
|
|
712
718
|
// showing a hover for a method you can already see adds no value.
|
|
@@ -207,7 +207,7 @@ module Mbeditor
|
|
|
207
207
|
language = params[:language].to_s.strip
|
|
208
208
|
|
|
209
209
|
return render json: { results: [] } if symbol.blank?
|
|
210
|
-
return render json: { error: "Invalid symbol" }, status: :bad_request unless symbol.match?(/\A[a-zA-
|
|
210
|
+
return render json: { error: "Invalid symbol" }, status: :bad_request unless symbol.match?(/\A[a-zA-Z_]\w{0,59}[!?]?\z/)
|
|
211
211
|
|
|
212
212
|
results = case language
|
|
213
213
|
when "ruby"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<script src="<%= asset_path('marked.min.js') %>"></script>
|
|
30
30
|
<!-- ── Monaco loader ─────────────────────────────────── -->
|
|
31
31
|
<% base_path = request.script_name.to_s.sub(%r{/$}, '') %>
|
|
32
|
-
<script>var require = { paths: { vs: '<%= json_escape("#{base_path}/monaco-editor/vs") %>', 'monaco-vim': '<%= json_escape(asset_path("monaco-vim.js").sub(/\.js$/, "")) %>'
|
|
32
|
+
<script>var require = { paths: { vs: '<%= json_escape("#{base_path}/monaco-editor/vs") %>', 'monaco-vim': '<%= json_escape(asset_path("monaco-vim.js").sub(/\.js$/, "")) %>' } };</script>
|
|
33
33
|
<script src="<%= "#{base_path}/monaco-editor/vs/loader.js" %>"></script>
|
|
34
34
|
<!-- ── Emmet + Extra themes (non-AMD, load before app) ── -->
|
|
35
35
|
<script src="<%= asset_path('emmet.js') %>"></script>
|
|
@@ -38,16 +38,6 @@
|
|
|
38
38
|
<body data-rails-root="<%= Rails.root.to_s %>" data-mbeditor-version="<%= Mbeditor::VERSION %>">
|
|
39
39
|
<script>
|
|
40
40
|
window.MBEDITOR_BASE_PATH = "<%= json_escape(base_path) %>";
|
|
41
|
-
|
|
42
|
-
// Monaco's restoreViewState cancels its own internal rendering promises and
|
|
43
|
-
// those cancellations surface as "Canceled: Canceled" unhandled rejections.
|
|
44
|
-
// This is a known Monaco quirk — the cancellation is intentional and benign.
|
|
45
|
-
// Suppress it here so it doesn't pollute the console.
|
|
46
|
-
window.addEventListener('unhandledrejection', function(event) {
|
|
47
|
-
if (event.reason && event.reason.name === 'Canceled' && event.reason.message === 'Canceled') {
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
41
|
</script>
|
|
52
42
|
|
|
53
43
|
<div id="mbeditor-root">
|
data/lib/mbeditor/version.rb
CHANGED