monaco-editor-core 0.58.0-rc.2 → 0.59.0-dev-20261121
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/esm/nls.messages.cs.js +1 -1
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.pl.js +1 -1
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.tr.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/common/cancellation.js +3 -1
- package/esm/vs/base/common/cancellation.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +1 -0
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/hoverTypes.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +9 -2
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/links/browser/links.js +1 -0
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationModels.js +13 -3
- package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
- package/package.json +2 -2
- package/version.txt +1 -1
package/esm/nls.messages.cs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.de.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.fr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.it.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.ja.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.ko.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.pl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.ru.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.tr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.
|
|
3
|
+
* Version: 0.59.0-dev-20261121(6d48a091e09b60c9948f1524cf303eb6eea25086)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
|
@@ -76,7 +76,9 @@ export var CancellationToken;
|
|
|
76
76
|
return CancellationToken.Cancelled;
|
|
77
77
|
}
|
|
78
78
|
const token = lifetime.add(new MutableToken());
|
|
79
|
-
|
|
79
|
+
const onAbort = () => token.cancel();
|
|
80
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
81
|
+
lifetime.add(toDisposable(() => signal.removeEventListener('abort', onAbort)));
|
|
80
82
|
return token;
|
|
81
83
|
}
|
|
82
84
|
CancellationToken.fromAbortSignal = fromAbortSignal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/cancellation.ts","vs/base/common/cancellation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoB5E,MAAM,aAAa,GAAgB,MAAM,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,OAAQ;IAC5E,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,EAAE,OAAO,KAAK,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC,CAAC,CAAC;AAEH,MAAM,KAAW,iBAAiB,CAsFjC;AAtFD,WAAiB,iBAAiB;IAEjC,SAAgB,mBAAmB,CAAC,KAAc;QACjD,IAAI,KAAK,KAAK,iBAAiB,CAAC,IAA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,CAAC,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC;QAEtC,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,YAAY,YAAY,EAAE,CAAC;YAChD,mBAAmB;YACnB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;CACD;AAED,MAAM,UAAU,eAAe,CAAC,KAAsB;IACrD,MAAM,MAAM,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAC7C,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC","file":"cancellation.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tlifetime.add(Event.once(Event.fromDOMEventEmitter(signal, 'abort'))(() => token.cancel()));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tlifetime.add(Event.once(Event.fromDOMEventEmitter(signal, 'abort'))(() => token.cancel()));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/cancellation.ts","vs/base/common/cancellation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoB5E,MAAM,aAAa,GAAgB,MAAM,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,OAAQ;IAC5E,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,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C,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,YAAY,YAAY,EAAE,CAAC;YAChD,kBAAkB;YAClB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;IACF,CAAC;IAED,OAAO,CAAC,SAAkB,KAAK;QAC9B,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,MAAM,EAAE,CAAC;QACf,CAAC;QACD,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,0DAA0D;YAC1D,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC;QAEtC,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,YAAY,YAAY,EAAE,CAAC;YAChD,mBAAmB;YACnB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;CACD;AAED,MAAM,UAAU,eAAe,CAAC,KAAsB;IACrD,MAAM,MAAM,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAC7C,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC","file":"cancellation.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tconst onAbort = () => token.cancel();\n\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\t\tlifetime.add(toDisposable(() => signal.removeEventListener('abort', onAbort)));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tconst onAbort = () => token.cancel();\n\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\t\tlifetime.add(toDisposable(() => signal.removeEventListener('abort', onAbort)));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n"]}
|
|
@@ -1932,6 +1932,7 @@ export class ModelDecorationOptions {
|
|
|
1932
1932
|
this.className = options.className ? cleanClassName(options.className) : null;
|
|
1933
1933
|
this.shouldFillLineOnLineBreak = options.shouldFillLineOnLineBreak ?? null;
|
|
1934
1934
|
this.hoverMessage = options.hoverMessage || null;
|
|
1935
|
+
this.hoverMessageCopyContent = options.hoverMessageCopyContent;
|
|
1935
1936
|
this.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;
|
|
1936
1937
|
this.lineNumberHoverMessage = options.lineNumberHoverMessage || null;
|
|
1937
1938
|
this.isWholeLine = options.isWholeLine || false;
|