@codingame/monaco-editor-wrapper 11.0.0 → 12.0.0
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.
- package/dist/assets/cobol-extension.js +18 -16
- package/dist/configuration/index.js +5 -3
- package/dist/customExtensions/cobol.js +12 -6
- package/dist/features/extensionHostWorker.js +3 -1
- package/dist/features/typescriptStandalone.js +3 -1
- package/dist/keybindings/index.js +1 -1
- package/dist/monaco.js +1 -1
- package/dist/node_modules/monaco-emacs/lib/emacs/actions.js +2 -2
- package/dist/node_modules/monaco-emacs/lib/emacs/basicInput.js +1 -1
- package/dist/node_modules/monaco-emacs/lib/emacs/commands.js +1 -1
- package/dist/node_modules/monaco-emacs/lib/emacs/index.js +1 -1
- package/dist/node_modules/monaco-emacs/lib/emacs/state.js +3 -3
- package/dist/node_modules/monaco-emacs/lib/emacs/util.js +1 -1
- package/dist/node_modules/monaco-emacs/lib/index.js +1 -1
- package/dist/node_modules/monaco-vim/lib/cm/keymap_vim.js +1 -1
- package/dist/node_modules/monaco-vim/lib/cm_adapter.js +6 -6
- package/dist/node_modules/monaco-vim/lib/statusbar.js +2 -2
- package/dist/services.js +4 -2
- package/dist/tools/EditorOpenHandlerRegistry.js +7 -2
- package/dist/tools/crossOriginWorker.js +18 -18
- package/dist/tools/utils/editorOperationUtils.js +5 -3
- package/dist/tools/utils/rangeUtils.js +5 -3
- package/dist/tools.js +22 -19
- package/dist/worker.js +3 -1
- package/package.json +95 -94
- package/stats.html +1 -1
|
@@ -3,7 +3,7 @@ const vscode = require('vscode')
|
|
|
3
3
|
const fixedPositions = [0, 6, 7, 11]
|
|
4
4
|
const lastFixedPosition = fixedPositions[fixedPositions.length - 1]
|
|
5
5
|
|
|
6
|
-
function findFirstNonSpacePosition
|
|
6
|
+
function findFirstNonSpacePosition(line) {
|
|
7
7
|
for (let i = 0; i < line.length; i++) {
|
|
8
8
|
if (line[i] !== ' ') {
|
|
9
9
|
return i
|
|
@@ -12,19 +12,20 @@ function findFirstNonSpacePosition (line) {
|
|
|
12
12
|
return line.length
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async function indentEditor
|
|
16
|
-
await editor.edit(builder => {
|
|
15
|
+
async function indentEditor(editor) {
|
|
16
|
+
await editor.edit((builder) => {
|
|
17
17
|
for (const selection of editor.selections) {
|
|
18
18
|
for (let lineNumber = selection.start.line; lineNumber <= selection.end.line; lineNumber++) {
|
|
19
19
|
const line = editor.document.lineAt(lineNumber).text
|
|
20
20
|
const nonSpacePosition = findFirstNonSpacePosition(line)
|
|
21
|
-
const nextFixedPosition = fixedPositions.find(p => p > nonSpacePosition)
|
|
21
|
+
const nextFixedPosition = fixedPositions.find((p) => p > nonSpacePosition)
|
|
22
22
|
|
|
23
23
|
let expectedIndent = nextFixedPosition
|
|
24
24
|
if (expectedIndent == null) {
|
|
25
25
|
const indentWidth = editor.options.tabSize
|
|
26
|
-
const expectedIndentCount =
|
|
27
|
-
|
|
26
|
+
const expectedIndentCount =
|
|
27
|
+
Math.floor((nonSpacePosition - lastFixedPosition) / indentWidth) + 1
|
|
28
|
+
expectedIndent = lastFixedPosition + indentWidth * expectedIndentCount
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const toInsert = expectedIndent - nonSpacePosition
|
|
@@ -35,31 +36,32 @@ async function indentEditor (editor) {
|
|
|
35
36
|
})
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
async function unindentEditor
|
|
39
|
-
await editor.edit(builder => {
|
|
39
|
+
async function unindentEditor(editor) {
|
|
40
|
+
await editor.edit((builder) => {
|
|
40
41
|
for (const selection of editor.selections) {
|
|
41
42
|
for (let lineNumber = selection.start.line; lineNumber <= selection.end.line; lineNumber++) {
|
|
42
43
|
const line = editor.document.lineAt(lineNumber).text
|
|
43
44
|
const nonSpacePosition = findFirstNonSpacePosition(line)
|
|
44
45
|
const fixedIndentWidth = editor.options.tabSize
|
|
45
|
-
const prevFixedPosition =
|
|
46
|
+
const prevFixedPosition =
|
|
47
|
+
fixedPositions
|
|
48
|
+
.slice()
|
|
49
|
+
.reverse()
|
|
50
|
+
.find((p) => p < nonSpacePosition) ?? 0
|
|
46
51
|
|
|
47
52
|
let expectedIndent = prevFixedPosition
|
|
48
53
|
|
|
49
54
|
if (prevFixedPosition === lastFixedPosition) {
|
|
50
55
|
// Instead of going back to the last fixed position, go to the nearest (prevFixedPosition + tabSize * N) position
|
|
51
|
-
const expectedIndentCount = Math.floor(
|
|
56
|
+
const expectedIndentCount = Math.floor(
|
|
57
|
+
(nonSpacePosition - lastFixedPosition - 1) / fixedIndentWidth
|
|
58
|
+
)
|
|
52
59
|
expectedIndent = lastFixedPosition + fixedIndentWidth * expectedIndentCount
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
const toRemove = nonSpacePosition - expectedIndent
|
|
56
63
|
|
|
57
|
-
builder.delete(new vscode.Range(
|
|
58
|
-
lineNumber,
|
|
59
|
-
0,
|
|
60
|
-
lineNumber,
|
|
61
|
-
0 + toRemove
|
|
62
|
-
))
|
|
64
|
+
builder.delete(new vscode.Range(lineNumber, 0, lineNumber, 0 + toRemove))
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
})
|
|
@@ -2,7 +2,8 @@ import { StandaloneServices, IConfigurationService } from '@codingame/monaco-vsc
|
|
|
2
2
|
import { configurationRegistry } from '@codingame/monaco-vscode-configuration-service-override';
|
|
3
3
|
export { getUserConfiguration, onUserConfigurationChange, updateUserConfiguration } from '@codingame/monaco-vscode-configuration-service-override';
|
|
4
4
|
|
|
5
|
-
configurationRegistry.registerDefaultConfigurations([
|
|
5
|
+
configurationRegistry.registerDefaultConfigurations([
|
|
6
|
+
{
|
|
6
7
|
overrides: {
|
|
7
8
|
'editor.codeLens': false,
|
|
8
9
|
'editor.fontSize': 12,
|
|
@@ -26,7 +27,8 @@ configurationRegistry.registerDefaultConfigurations([{
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
}
|
|
30
|
+
}
|
|
31
|
+
]);
|
|
30
32
|
function onConfigurationChanged(listener) {
|
|
31
33
|
const configurationService = StandaloneServices.get(IConfigurationService);
|
|
32
34
|
return configurationService.onDidChangeConfiguration(listener);
|
|
@@ -39,7 +41,7 @@ function registerConfigurations(configurations, validate) {
|
|
|
39
41
|
configurationRegistry.registerConfigurations(configurations, validate);
|
|
40
42
|
}
|
|
41
43
|
function registerDefaultConfigurations(defaultConfigurations) {
|
|
42
|
-
configurationRegistry.registerDefaultConfigurations(defaultConfigurations.map(overrides => ({ overrides })));
|
|
44
|
+
configurationRegistry.registerDefaultConfigurations(defaultConfigurations.map((overrides) => ({ overrides })));
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export { getConfiguration, onConfigurationChanged, registerConfigurations, registerDefaultConfigurations };
|
|
@@ -9,24 +9,30 @@ const { registerFileUrl } = registerExtension({
|
|
|
9
9
|
},
|
|
10
10
|
activationEvents: ['onLanguage:cobol'],
|
|
11
11
|
contributes: {
|
|
12
|
-
commands: [
|
|
12
|
+
commands: [
|
|
13
|
+
{
|
|
13
14
|
command: 'cobol-indent',
|
|
14
15
|
title: 'Indent cobol',
|
|
15
16
|
enablement: 'editorLangId == cobol && !inSnippetMode'
|
|
16
|
-
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
17
19
|
command: 'cobol-unindent',
|
|
18
20
|
title: 'Unindent cobol',
|
|
19
21
|
enablement: 'editorLangId == cobol && !inSnippetMode'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
keybindings: [
|
|
25
|
+
{
|
|
22
26
|
command: 'cobol-indent',
|
|
23
27
|
key: 'tab',
|
|
24
28
|
when: 'editorLangId == cobol && !inSnippetMode'
|
|
25
|
-
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
26
31
|
command: 'cobol-unindent',
|
|
27
32
|
key: 'shift+tab',
|
|
28
33
|
when: 'editorLangId == cobol && !inSnippetMode'
|
|
29
|
-
}
|
|
34
|
+
}
|
|
35
|
+
]
|
|
30
36
|
},
|
|
31
37
|
browser: './extension.js'
|
|
32
38
|
}, ExtensionHostKind.LocalWebWorker);
|
|
@@ -2,7 +2,9 @@ import getExtensionServiceOverride from '@codingame/monaco-vscode-extensions-ser
|
|
|
2
2
|
import { registerServices } from '../services.js';
|
|
3
3
|
import { Worker } from '../tools/FakeWorker.js';
|
|
4
4
|
|
|
5
|
-
const fakeWorker = new Worker(new URL('vscode/workers/extensionHost.worker', import.meta.url), {
|
|
5
|
+
const fakeWorker = new Worker(new URL('@codingame/monaco-vscode-api/workers/extensionHost.worker', import.meta.url), {
|
|
6
|
+
type: 'module'
|
|
7
|
+
});
|
|
6
8
|
registerServices({
|
|
7
9
|
...getExtensionServiceOverride({
|
|
8
10
|
url: fakeWorker.url.toString(),
|
|
@@ -31,7 +31,9 @@ const compilerOptions = {
|
|
|
31
31
|
class TypescriptWorkerTypeFileSystemProvider {
|
|
32
32
|
constructor(getWorker) {
|
|
33
33
|
this.getWorker = getWorker;
|
|
34
|
-
this.capabilities = FileSystemProviderCapabilities.FileReadWrite |
|
|
34
|
+
this.capabilities = FileSystemProviderCapabilities.FileReadWrite |
|
|
35
|
+
FileSystemProviderCapabilities.PathCaseSensitive |
|
|
36
|
+
FileSystemProviderCapabilities.Readonly;
|
|
35
37
|
this.onDidChangeCapabilities = new vscode.EventEmitter().event;
|
|
36
38
|
this.onDidChangeFile = new vscode.EventEmitter().event;
|
|
37
39
|
}
|
|
@@ -8,7 +8,7 @@ class PromiseDisposable {
|
|
|
8
8
|
this.promise = promise;
|
|
9
9
|
}
|
|
10
10
|
dispose() {
|
|
11
|
-
this.promise.then(disposable => disposable.dispose(), console.error);
|
|
11
|
+
this.promise.then((disposable) => disposable.dispose(), console.error);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
function updateEditorKeybindingsMode(editor, keyBindingsMode = 'classic', statusBarElement) {
|
package/dist/monaco.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { errorHandler, createConfiguredEditor, createModelReference as createModelReference$1 } from '@codingame/monaco-vscode-api/monaco';
|
|
2
2
|
import { isInitialized, initializePromise, editorOpenHandlerRegistry } from './services.js';
|
|
3
3
|
|
|
4
|
-
errorHandler.setUnexpectedErrorHandler(error => {
|
|
4
|
+
errorHandler.setUnexpectedErrorHandler((error) => {
|
|
5
5
|
console.warn('Unexpected error', error);
|
|
6
6
|
});
|
|
7
7
|
function createEditor(domElement, options) {
|
|
@@ -23,11 +23,11 @@ function requireActions () {
|
|
|
23
23
|
};
|
|
24
24
|
})();
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.DeleteLines = exports.SearchReplace = exports.Search = exports.InvertSelection = exports.GotoLine = exports.RotateCursorOnScreen = exports.InsertTabs = exports.RevealToBottomAction = exports.RevealToCenterAction = exports.RevealToTopAction = exports.RevealEditorAction = exports.YankRotate = exports.YankSelectionToRing = exports.Yank = exports.RedoAction = exports.UndoAction = exports.KeyBoardQuit = exports.MoveCursorTop = exports.MoveCursorBottom = exports.MoveCursorWordLeft = exports.MoveCursorWordRight = exports.MoveCursorToLineStart = exports.MoveCursorToLineEnd = exports.MoveCursorRight = exports.MoveCursorLeft = exports.MoveCursorDown = exports.MoveCursorUp = exports.SetMark = exports.InsertLineAfter = exports.InsertLineBelow = exports.KillLines = exports.KillSelection = exports.BaseAction = exports.SOURCE =
|
|
26
|
+
exports.DeleteLines = exports.SearchReplace = exports.Search = exports.InvertSelection = exports.GotoLine = exports.RotateCursorOnScreen = exports.InsertTabs = exports.RevealToBottomAction = exports.RevealToCenterAction = exports.RevealToTopAction = exports.RevealEditorAction = exports.YankRotate = exports.YankSelectionToRing = exports.Yank = exports.RedoAction = exports.UndoAction = exports.KeyBoardQuit = exports.MoveCursorTop = exports.MoveCursorBottom = exports.MoveCursorWordLeft = exports.MoveCursorWordRight = exports.MoveCursorToLineStart = exports.MoveCursorToLineEnd = exports.MoveCursorRight = exports.MoveCursorLeft = exports.MoveCursorDown = exports.MoveCursorUp = exports.SetMark = exports.InsertLineAfter = exports.InsertLineBelow = exports.KillLines = exports.KillSelection = exports.BaseAction = exports.SOURCE = void 0;
|
|
27
27
|
var monaco = require$$0;
|
|
28
28
|
exports.SOURCE = 'extension.emacs';
|
|
29
29
|
function moveCursor(editor, hasSelection, direction, unit, repeat) {
|
|
30
|
-
if (repeat ===
|
|
30
|
+
if (repeat === void 0) { repeat = 1; }
|
|
31
31
|
var action = "cursor".concat(unit === 'word' ? 'Word' : '').concat(direction).concat(hasSelection ? 'Select' : '');
|
|
32
32
|
for (var i = 0; i < repeat; i++) {
|
|
33
33
|
editor.trigger(exports.SOURCE, action, null);
|
|
@@ -7,7 +7,7 @@ function requireBasicInput () {
|
|
|
7
7
|
if (hasRequiredBasicInput) return basicInput;
|
|
8
8
|
hasRequiredBasicInput = 1;
|
|
9
9
|
Object.defineProperty(basicInput, "__esModule", { value: true });
|
|
10
|
-
basicInput.BasicInputWidget =
|
|
10
|
+
basicInput.BasicInputWidget = void 0;
|
|
11
11
|
var monaco = require$$0;
|
|
12
12
|
var BASE_CLASS = 'ext-emacs-basic-input';
|
|
13
13
|
function generateCss() {
|
|
@@ -8,7 +8,7 @@ function requireCommands () {
|
|
|
8
8
|
hasRequiredCommands = 1;
|
|
9
9
|
(function (exports) {
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.getAllMappings = exports.unregisterKey = exports.registerGlobalCommand = exports.executeCommand = exports.COMMANDS = exports.prefixPreservingKeys =
|
|
11
|
+
exports.getAllMappings = exports.unregisterKey = exports.registerGlobalCommand = exports.executeCommand = exports.COMMANDS = exports.prefixPreservingKeys = void 0;
|
|
12
12
|
var Actions = requireActions();
|
|
13
13
|
exports.prefixPreservingKeys = {
|
|
14
14
|
"M-g": true,
|
|
@@ -13,7 +13,7 @@ function requireEmacs () {
|
|
|
13
13
|
if (hasRequiredEmacs) return emacs;
|
|
14
14
|
hasRequiredEmacs = 1;
|
|
15
15
|
Object.defineProperty(emacs, "__esModule", { value: true });
|
|
16
|
-
emacs.getConfiguration = emacs.EmacsExtension =
|
|
16
|
+
emacs.getConfiguration = emacs.EmacsExtension = void 0;
|
|
17
17
|
var monaco = require$$0;
|
|
18
18
|
var throttle = requireLodash_throttle();
|
|
19
19
|
var kebabCase = requireLodash_kebabcase();
|
|
@@ -8,7 +8,7 @@ function requireState () {
|
|
|
8
8
|
hasRequiredState = 1;
|
|
9
9
|
(function (exports) {
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.State = exports.EAT_UP_KEY =
|
|
11
|
+
exports.State = exports.EAT_UP_KEY = void 0;
|
|
12
12
|
var commands_1 = requireCommands();
|
|
13
13
|
exports.EAT_UP_KEY = '==-==';
|
|
14
14
|
var State = (function () {
|
|
@@ -42,7 +42,7 @@ function requireState () {
|
|
|
42
42
|
return this._lastCommandKey == lastCommandKey;
|
|
43
43
|
};
|
|
44
44
|
State.prototype.resetState = function (setLastInput) {
|
|
45
|
-
if (setLastInput ===
|
|
45
|
+
if (setLastInput === void 0) { setLastInput = false; }
|
|
46
46
|
this._inargumentMode = setLastInput;
|
|
47
47
|
this._prefixKey = null;
|
|
48
48
|
if (setLastInput) {
|
|
@@ -72,7 +72,7 @@ function requireState () {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
State.prototype.updateStateOnExecution = function (reset) {
|
|
75
|
-
if (reset ===
|
|
75
|
+
if (reset === void 0) { reset = false; }
|
|
76
76
|
this.resetState(reset);
|
|
77
77
|
};
|
|
78
78
|
State.prototype.getInputBuffer = function () {
|
|
@@ -8,7 +8,7 @@ function requireUtil () {
|
|
|
8
8
|
hasRequiredUtil = 1;
|
|
9
9
|
(function (exports) {
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.Emitter = exports.Event = exports.monacoToEmacsKey = exports.modifierKeys =
|
|
11
|
+
exports.Emitter = exports.Event = exports.monacoToEmacsKey = exports.modifierKeys = void 0;
|
|
12
12
|
var monaco = require$$0;
|
|
13
13
|
exports.modifierKeys = {
|
|
14
14
|
Alt: 'M',
|
|
@@ -10,7 +10,7 @@ function requireLib () {
|
|
|
10
10
|
hasRequiredLib = 1;
|
|
11
11
|
(function (exports) {
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Actions = exports.EmacsExtension = exports.unregisterKey = exports.getAllMappings = exports.registerGlobalCommand =
|
|
13
|
+
exports.Actions = exports.EmacsExtension = exports.unregisterKey = exports.getAllMappings = exports.registerGlobalCommand = void 0;
|
|
14
14
|
var emacs_1 = requireEmacs();
|
|
15
15
|
Object.defineProperty(exports, "EmacsExtension", { enumerable: true, get: function () { return emacs_1.EmacsExtension; } });
|
|
16
16
|
var commands_1 = requireCommands();
|
|
@@ -11,7 +11,7 @@ function requireKeymap_vim () {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", {
|
|
12
12
|
value: true
|
|
13
13
|
});
|
|
14
|
-
exports["default"] = exports.Vim =
|
|
14
|
+
exports["default"] = exports.Vim = void 0;
|
|
15
15
|
var _cm_adapter = _interopRequireDefault(requireCm_adapter());
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
17
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /**
|
|
@@ -12,12 +12,12 @@ function requireCm_adapter () {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
exports["default"] =
|
|
15
|
+
exports["default"] = void 0;
|
|
16
16
|
var _editor = require$$0;
|
|
17
17
|
var _shiftCommand = require$$1;
|
|
18
18
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
19
19
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) :
|
|
20
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
21
21
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22
22
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = true, o = false; try { if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = true, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
23
23
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
@@ -26,7 +26,7 @@ function requireCm_adapter () {
|
|
|
26
26
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
27
27
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e; }
|
|
28
28
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
29
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (
|
|
29
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(t); } /**
|
|
30
30
|
* An adapter to make CodeMirror's vim bindings work with monaco
|
|
31
31
|
*/
|
|
32
32
|
var VerticalRevealType = {
|
|
@@ -355,7 +355,7 @@ function requireCm_adapter () {
|
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
357
|
listeners.forEach(function (handler) {
|
|
358
|
-
return handler.apply(
|
|
358
|
+
return handler.apply(void 0, args);
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
}, {
|
|
@@ -753,7 +753,7 @@ function requireCm_adapter () {
|
|
|
753
753
|
res = model.bracketPairs.matchBracket(mPos);
|
|
754
754
|
} else {
|
|
755
755
|
var _model$matchBracket;
|
|
756
|
-
res = (_model$matchBracket = model.matchBracket) === null || _model$matchBracket ===
|
|
756
|
+
res = (_model$matchBracket = model.matchBracket) === null || _model$matchBracket === void 0 ? void 0 : _model$matchBracket.call(model, mPos);
|
|
757
757
|
}
|
|
758
758
|
if (!res || !(res.length === 2)) {
|
|
759
759
|
return {
|
|
@@ -798,7 +798,7 @@ function requireCm_adapter () {
|
|
|
798
798
|
return;
|
|
799
799
|
case "bottom":
|
|
800
800
|
// private api. no other way
|
|
801
|
-
(_editor$_revealRange = editor._revealRange) === null || _editor$_revealRange ===
|
|
801
|
+
(_editor$_revealRange = editor._revealRange) === null || _editor$_revealRange === void 0 || _editor$_revealRange.call(editor, range, VerticalRevealType.Bottom);
|
|
802
802
|
return;
|
|
803
803
|
}
|
|
804
804
|
}
|
|
@@ -10,13 +10,13 @@ function requireStatusbar () {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", {
|
|
11
11
|
value: true
|
|
12
12
|
});
|
|
13
|
-
exports["default"] =
|
|
13
|
+
exports["default"] = void 0;
|
|
14
14
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
15
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
16
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
17
17
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e; }
|
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(t); }
|
|
20
20
|
exports["default"] = /*#__PURE__*/function () {
|
|
21
21
|
function VimStatusBar(node, editor) {
|
|
22
22
|
var _this = this;
|
package/dist/services.js
CHANGED
|
@@ -90,9 +90,11 @@ function registerServices(newServices) {
|
|
|
90
90
|
}
|
|
91
91
|
function generateAndInitializeWorkspace(workspaceFile = monaco.Uri.file('/workspace.code-workspace'), label) {
|
|
92
92
|
registerFile(new RegisteredMemoryFile(workspaceFile, JSON.stringify({
|
|
93
|
-
folders: [
|
|
93
|
+
folders: [
|
|
94
|
+
{
|
|
94
95
|
path: '/tmp/project'
|
|
95
|
-
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
96
98
|
})));
|
|
97
99
|
return {
|
|
98
100
|
open: async () => false,
|
|
@@ -17,7 +17,11 @@ function openNewCodeEditor(modelRef) {
|
|
|
17
17
|
container.style.cursor = 'pointer';
|
|
18
18
|
const editorElem = document.createElement('div');
|
|
19
19
|
editorElem.style.position = 'absolute';
|
|
20
|
-
editorElem.style.top =
|
|
20
|
+
editorElem.style.top =
|
|
21
|
+
editorElem.style.bottom =
|
|
22
|
+
editorElem.style.left =
|
|
23
|
+
editorElem.style.right =
|
|
24
|
+
'0';
|
|
21
25
|
editorElem.style.margin = 'auto';
|
|
22
26
|
editorElem.style.width = '80%';
|
|
23
27
|
editorElem.style.height = '80%';
|
|
@@ -75,7 +79,8 @@ class EditorOpenHandlerRegistry {
|
|
|
75
79
|
onModelUnmount();
|
|
76
80
|
});
|
|
77
81
|
const onDidChangeModelDisposable = modelEditor.onDidChangeModel((e) => {
|
|
78
|
-
if (e.newModelUrl == null ||
|
|
82
|
+
if (e.newModelUrl == null ||
|
|
83
|
+
e.newModelUrl.toString() !== modelRef.object.textEditorModel.uri.toString()) {
|
|
79
84
|
onModelUnmount();
|
|
80
85
|
onDidDisposeDisposable.dispose();
|
|
81
86
|
onDidChangeModelDisposable.dispose();
|
|
@@ -10,24 +10,24 @@ class Worker extends window.Worker {
|
|
|
10
10
|
super(
|
|
11
11
|
// Check if the URL is remote
|
|
12
12
|
url.includes('://') && !url.startsWith(location.origin)
|
|
13
|
-
// Launch the worker with an inline script that will use `importScripts`
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
? // Launch the worker with an inline script that will use `importScripts`
|
|
14
|
+
// to bootstrap the actual script to work around the same origin policy.
|
|
15
|
+
URL.createObjectURL(new Blob([
|
|
16
|
+
// Replace the `importScripts` function with
|
|
17
|
+
// a patched version that will resolve relative URLs
|
|
18
|
+
// to the remote script URL.
|
|
19
|
+
//
|
|
20
|
+
// Without a patched `importScripts` Webpack 5 generated worker chunks will fail with the following error:
|
|
21
|
+
//
|
|
22
|
+
// Uncaught (in promise) DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope':
|
|
23
|
+
// The script at 'http://some.domain/worker.1e0e1e0e.js' failed to load.
|
|
24
|
+
//
|
|
25
|
+
// For minification, the inlined variable names are single letters:
|
|
26
|
+
// i = original importScripts
|
|
27
|
+
// a = arguments
|
|
28
|
+
// u = URL
|
|
29
|
+
`importScripts=((i)=>(...a)=>i(...a.map((u)=>''+new URL(u,"${url}"))))(importScripts);importScripts("${url}")`
|
|
30
|
+
], { type: 'text/javascript' }))
|
|
31
31
|
: scriptURL, options);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -8,7 +8,8 @@ function createNewOperation(oldOperation, newRange, newText, index) {
|
|
|
8
8
|
const identifier = oldOperation.identifier != null
|
|
9
9
|
? { major: oldOperation.identifier.major, minor: oldOperation.identifier.minor + index }
|
|
10
10
|
: null;
|
|
11
|
-
return new ValidAnnotatedEditOperation(identifier, newRange,
|
|
11
|
+
return new ValidAnnotatedEditOperation(identifier, newRange, // desync between monaco type and VSCode class, force cast
|
|
12
|
+
newText, oldOperation.forceMoveMarkers, oldOperation.isAutoWhitespaceEdit, oldOperation._isTracked);
|
|
12
13
|
}
|
|
13
14
|
function createNewOperationsFromRanges(oldOperation, editableRanges, splitText) {
|
|
14
15
|
if (editableRanges.length <= 0) {
|
|
@@ -24,7 +25,7 @@ function tryIgnoreLockedCodeTextForOperation(model, uneditableRangesInOperationR
|
|
|
24
25
|
return [operationText];
|
|
25
26
|
}
|
|
26
27
|
const splitText = [];
|
|
27
|
-
const uneditableRangesText = uneditableRangesInOperationRange.map(range => model.getValueInRange(range));
|
|
28
|
+
const uneditableRangesText = uneditableRangesInOperationRange.map((range) => model.getValueInRange(range));
|
|
28
29
|
let currentRange = 0;
|
|
29
30
|
let remainingText = normalizeStringLineBreaks(operationText, model.getEOL());
|
|
30
31
|
while (remainingText.length > 0 && currentRange < uneditableRangesText.length) {
|
|
@@ -44,7 +45,8 @@ function tryIgnoreLockedCodeTextForOperation(model, uneditableRangesInOperationR
|
|
|
44
45
|
}
|
|
45
46
|
const uneditableRangeMaxEndColumn = model.getLineMaxColumn(currentUneditableRange.endLineNumber);
|
|
46
47
|
remainingText = remainingText.slice(rangeTextIndex + rangeText.length);
|
|
47
|
-
if (remainingText.startsWith('\n') &&
|
|
48
|
+
if (remainingText.startsWith('\n') &&
|
|
49
|
+
currentUneditableRange.endColumn === uneditableRangeMaxEndColumn) {
|
|
48
50
|
remainingText = remainingText.slice(1, remainingText.length);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -11,7 +11,7 @@ function excludeRanges(model, uniqueRange, ranges) {
|
|
|
11
11
|
const removedRanges = [];
|
|
12
12
|
let lastEndPosition = uniqueRange.getStartPosition();
|
|
13
13
|
const uniqueRangeEndPosition = uniqueRange.getEndPosition();
|
|
14
|
-
const intersectingRanges = ranges.filter(range => monaco.Range.areIntersectingOrTouching(range, uniqueRange));
|
|
14
|
+
const intersectingRanges = ranges.filter((range) => monaco.Range.areIntersectingOrTouching(range, uniqueRange));
|
|
15
15
|
for (const range of intersectingRanges) {
|
|
16
16
|
const rangeStart = range.getStartPosition();
|
|
17
17
|
const rangeEnd = range.getEndPosition();
|
|
@@ -19,10 +19,12 @@ function excludeRanges(model, uniqueRange, ranges) {
|
|
|
19
19
|
const firstRangeStart = lastEndPosition.equals(uniqueRange.getStartPosition())
|
|
20
20
|
? lastEndPosition
|
|
21
21
|
: model.modifyPosition(lastEndPosition, 1);
|
|
22
|
-
filteredRanges.push(monaco.Range.fromPositions(firstRangeStart,
|
|
22
|
+
filteredRanges.push(monaco.Range.fromPositions(firstRangeStart, model.modifyPosition(rangeStart, -1)));
|
|
23
23
|
}
|
|
24
24
|
const secondRangeStart = lastEndPosition.isBefore(rangeStart) ? rangeStart : lastEndPosition;
|
|
25
|
-
const secondRangeEnd = uniqueRangeEndPosition.isBefore(rangeEnd)
|
|
25
|
+
const secondRangeEnd = uniqueRangeEndPosition.isBefore(rangeEnd)
|
|
26
|
+
? uniqueRangeEndPosition
|
|
27
|
+
: rangeEnd;
|
|
26
28
|
removedRanges.push(monaco.Range.fromPositions(secondRangeStart, secondRangeEnd));
|
|
27
29
|
lastEndPosition = rangeEnd;
|
|
28
30
|
}
|
package/dist/tools.js
CHANGED
|
@@ -27,10 +27,12 @@ function extractRangesFromTokens(editor, startToken, endToken, isRegex = false)
|
|
|
27
27
|
/* matchCase */ true,
|
|
28
28
|
/* wordSeparators */ null,
|
|
29
29
|
/* captureMatches */ false);
|
|
30
|
-
if (matchEnd != null &&
|
|
30
|
+
if (matchEnd != null &&
|
|
31
|
+
matchEnd.range.getStartPosition().isBefore(match.range.getStartPosition())) {
|
|
31
32
|
break;
|
|
32
33
|
}
|
|
33
|
-
currentPosition =
|
|
34
|
+
currentPosition =
|
|
35
|
+
matchEnd?.range.getEndPosition() ?? editorModel.getFullModelRange().getEndPosition();
|
|
34
36
|
ranges.push(monaco.Range.fromPositions(match.range.getStartPosition(), currentPosition));
|
|
35
37
|
}
|
|
36
38
|
return ranges;
|
|
@@ -95,7 +97,7 @@ function lockCodeRanges(editor, { onError, allowChangeFromSources = [], getLocke
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
if (transactionMode) {
|
|
98
|
-
const firstForbiddenOperation = editorOperations.find(operation => !canEditRange(operation.range));
|
|
100
|
+
const firstForbiddenOperation = editorOperations.find((operation) => !canEditRange(operation.range));
|
|
99
101
|
if (firstForbiddenOperation != null) {
|
|
100
102
|
onError?.(editor, firstForbiddenOperation);
|
|
101
103
|
return [];
|
|
@@ -105,7 +107,7 @@ function lockCodeRanges(editor, { onError, allowChangeFromSources = [], getLocke
|
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
else {
|
|
108
|
-
return editorOperations.filter(operation => {
|
|
110
|
+
return editorOperations.filter((operation) => {
|
|
109
111
|
if (!canEditRange(operation.range)) {
|
|
110
112
|
onError?.(editor, operation);
|
|
111
113
|
return false;
|
|
@@ -145,7 +147,9 @@ function lockCodeRanges(editor, { onError, allowChangeFromSources = [], getLocke
|
|
|
145
147
|
}
|
|
146
148
|
function lockCodeWithDecoration(editor, lockOptions) {
|
|
147
149
|
return lockCodeRanges(editor, {
|
|
148
|
-
onError: lockOptions.errorMessage != null
|
|
150
|
+
onError: lockOptions.errorMessage != null
|
|
151
|
+
? generateErrorMessageErrorHandler(lockOptions.errorMessage)
|
|
152
|
+
: undefined,
|
|
149
153
|
allowChangeFromSources: lockOptions.allowChangeFromSources,
|
|
150
154
|
getLockedRanges() {
|
|
151
155
|
const model = editor.getModel();
|
|
@@ -160,7 +164,9 @@ function lockCodeWithDecoration(editor, lockOptions) {
|
|
|
160
164
|
}
|
|
161
165
|
function lockCodeWithoutDecoration(editor, lockOptions) {
|
|
162
166
|
return lockCodeRanges(editor, {
|
|
163
|
-
onError: lockOptions.errorMessage != null
|
|
167
|
+
onError: lockOptions.errorMessage != null
|
|
168
|
+
? generateErrorMessageErrorHandler(lockOptions.errorMessage)
|
|
169
|
+
: undefined,
|
|
164
170
|
allowChangeFromSources: lockOptions.allowChangeFromSources,
|
|
165
171
|
getLockedRanges() {
|
|
166
172
|
const model = editor.getModel();
|
|
@@ -181,13 +187,12 @@ function hideCodeWithoutDecoration(editor, decorationFilter) {
|
|
|
181
187
|
if (model == null) {
|
|
182
188
|
return;
|
|
183
189
|
}
|
|
184
|
-
const decorations = model.getAllDecorations()
|
|
185
|
-
.filter(decorationFilter);
|
|
190
|
+
const decorations = model.getAllDecorations().filter(decorationFilter);
|
|
186
191
|
if (decorations.length === 0) {
|
|
187
192
|
return;
|
|
188
193
|
}
|
|
189
194
|
const ranges = decorations
|
|
190
|
-
.map(decoration => decoration.range)
|
|
195
|
+
.map((decoration) => decoration.range)
|
|
191
196
|
.sort((a, b) => a.startLineNumber - b.startLineNumber)
|
|
192
197
|
// merge ranges
|
|
193
198
|
.reduce((acc, range) => {
|
|
@@ -202,10 +207,7 @@ function hideCodeWithoutDecoration(editor, decorationFilter) {
|
|
|
202
207
|
];
|
|
203
208
|
}
|
|
204
209
|
else {
|
|
205
|
-
return [
|
|
206
|
-
...acc,
|
|
207
|
-
range
|
|
208
|
-
];
|
|
210
|
+
return [...acc, range];
|
|
209
211
|
}
|
|
210
212
|
}, []);
|
|
211
213
|
const { filteredRanges: hiddenAreas, removedRanges: visibleRanges } = excludeRanges(model, model.getFullModelRange(), ranges);
|
|
@@ -213,9 +215,10 @@ function hideCodeWithoutDecoration(editor, decorationFilter) {
|
|
|
213
215
|
// Make sure only visible code is selected
|
|
214
216
|
const selections = editor.getSelections();
|
|
215
217
|
if (selections != null) {
|
|
216
|
-
let newSelections = selections.flatMap(selection => visibleRanges
|
|
218
|
+
let newSelections = selections.flatMap((selection) => visibleRanges
|
|
219
|
+
.map((visibleRange) => selection.intersectRanges(visibleRange))
|
|
217
220
|
.filter((range) => range != null)
|
|
218
|
-
.map(range => monaco.Selection.fromRange(range, selection.getDirection())));
|
|
221
|
+
.map((range) => monaco.Selection.fromRange(range, selection.getDirection())));
|
|
219
222
|
if (newSelections.length === 0 && visibleRanges.length > 0) {
|
|
220
223
|
newSelections = [monaco.Selection.fromPositions(visibleRanges[0].getStartPosition())];
|
|
221
224
|
}
|
|
@@ -245,7 +248,7 @@ function hideCodeWithoutDecoration(editor, decorationFilter) {
|
|
|
245
248
|
async function collapseCodeSectionsFromRanges(editor, ranges) {
|
|
246
249
|
if (ranges.length > 0) {
|
|
247
250
|
const selections = editor.getSelections();
|
|
248
|
-
editor.setSelections(ranges.map(r => ({
|
|
251
|
+
editor.setSelections(ranges.map((r) => ({
|
|
249
252
|
selectionStartLineNumber: r.startLineNumber,
|
|
250
253
|
selectionStartColumn: r.startColumn,
|
|
251
254
|
positionLineNumber: r.endLineNumber,
|
|
@@ -288,8 +291,8 @@ function registerTextDecorationProvider(provider) {
|
|
|
288
291
|
checkEditor();
|
|
289
292
|
return disposableStore;
|
|
290
293
|
};
|
|
291
|
-
monaco.editor.getEditors().forEach(editor => disposableStore.add(watchEditor(editor)));
|
|
292
|
-
disposableStore.add(monaco.editor.onDidCreateEditor(editor => disposableStore.add(watchEditor(editor))));
|
|
294
|
+
monaco.editor.getEditors().forEach((editor) => disposableStore.add(watchEditor(editor)));
|
|
295
|
+
disposableStore.add(monaco.editor.onDidCreateEditor((editor) => disposableStore.add(watchEditor(editor))));
|
|
293
296
|
return disposableStore;
|
|
294
297
|
}
|
|
295
298
|
function runOnAllEditors(cb) {
|
|
@@ -404,7 +407,7 @@ function mapClipboard(editor, { toClipboard, fromClipboard }) {
|
|
|
404
407
|
const transformed = toClipboard(content);
|
|
405
408
|
if (transformed !== content) {
|
|
406
409
|
if (clipdata.types != null) {
|
|
407
|
-
clipdata.types.forEach(type => clipdata.setData(type, toClipboard(content)));
|
|
410
|
+
clipdata.types.forEach((type) => clipdata.setData(type, toClipboard(content)));
|
|
408
411
|
}
|
|
409
412
|
else {
|
|
410
413
|
clipdata.setData('text/plain', toClipboard(content));
|